Class OAuthHandler
- java.lang.Object
-
- be.woutschoovaerts.mollie.handler.connect.OAuthHandler
-
public class OAuthHandler extends Object
Handles the Connect API Mollie docs- Author:
- Wout Schoovaerts
-
-
Constructor Summary
Constructors Constructor Description OAuthHandler(RestService restService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.TokenResponse
generateTokens(String clientId, String clientSecret, TokenRequest body)
Exchange the auth code received at the Authorize endpoint for an actual access token, with which you can communicate with the Mollie API.TokenResponse
generateTokens(String clientId, String clientSecret, TokenRequest body, QueryParams params)
Exchange the auth code received at the Authorize endpoint for an actual access token, with which you can communicate with the Mollie API.void
revokeToken(String clientId, String clientSecret, RevokeTokenRequest body)
Revoke an access- or a refresh token.void
revokeToken(String clientId, String clientSecret, RevokeTokenRequest body, QueryParams params)
Revoke an access- or a refresh token.
-
-
-
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 IDclientSecret
- The OAuth client IDbody
- 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 IDclientSecret
- The OAuth client IDbody
- TokenRequest objectparams
- 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 IDclientSecret
- The OAuth client IDbody
- 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 IDclientSecret
- The OAuth client IDbody
- RevokeTokenRequest objectparams
- A map of query parameters- Throws:
MollieException
- when something went wrong
-
-