Class OAuthHandler


  • public class OAuthHandler
    extends Object
    Handles the Connect API Mollie docs
    Author:
    Wout Schoovaerts
    • Constructor Detail

      • OAuthHandler

        public OAuthHandler​(RestService restService)
    • Method Detail

      • createAuthorizeUrl

        public String createAuthorizeUrl​(AuthorizeRequest request)
        The Authorize endpoint is the endpoint on Mollie web site where the merchant logs in, and grants authorization to your client application. E.g. when the merchant clicks on the Connect with Mollie button, you should redirect the merchant to the Authorize endpoint.

        The resource owner can then grant the authorization to your client application for the scopes you have requested.

        Mollie will then redirect the resource owner to the redirect_uri you have specified. The redirect_uri will be appended with a code parameter, which will contain the auth token. You should then exchange the auth token for an access token using the Tokens API.

        Parameters:
        request - AuthorizeRequest object
        Returns:
        The authorize URL
      • generateTokens

        public TokenResponse generateTokens​(String clientId,
                                            String clientSecret,
                                            TokenRequest body)
                                     throws MollieException
        Exchange the auth code received at the Authorize endpoint for an actual access token, with which you can communicate with the Mollie API.
        Parameters:
        clientId - The OAuth client ID
        clientSecret - The OAuth client ID
        body - TokenRequest object
        Returns:
        TokenResponse object
        Throws:
        MollieException - when something went wrong
      • generateTokens

        public TokenResponse generateTokens​(String clientId,
                                            String clientSecret,
                                            TokenRequest body,
                                            QueryParams params)
                                     throws MollieException
        Exchange the auth code received at the Authorize endpoint for an actual access token, with which you can communicate with the Mollie API.
        Parameters:
        clientId - The OAuth client ID
        clientSecret - The OAuth client ID
        body - TokenRequest object
        params - A map of query parameters
        Returns:
        TokenResponse object
        Throws:
        MollieException - when something went wrong
      • revokeToken

        public void revokeToken​(String clientId,
                                String clientSecret,
                                RevokeTokenRequest body)
                         throws MollieException
        Revoke an access- or a refresh token. Once revoked the token can not be used anymore.
        Parameters:
        clientId - The OAuth client ID
        clientSecret - The OAuth client ID
        body - RevokeTokenRequest object
        Throws:
        MollieException - when something went wrong
      • revokeToken

        public void revokeToken​(String clientId,
                                String clientSecret,
                                RevokeTokenRequest body,
                                QueryParams params)
                         throws MollieException
        Revoke an access- or a refresh token. Once revoked the token can not be used anymore.
        Parameters:
        clientId - The OAuth client ID
        clientSecret - The OAuth client ID
        body - RevokeTokenRequest object
        params - A map of query parameters
        Throws:
        MollieException - when something went wrong