GET https://my.mollie.com/oauth2/authorize
The authorize endpoint is a hosted OAuth authorization screen. It follows the OAuth 2 standard. You can use it to gather consent from another Mollie merchant for your app to access certain API resources on their behalf.
You should construct an authorization URL with the parameters below. Then, you can redirect your merchant to that URL. Typically this redirect sits behind a Connect with Mollie button.
Once redirected, the merchant will be asked to log in if they are not logged in yet. Next, the merchant will be asked to grant your app permission to access the requested resources on their account.
At the end of the flow, Mollie will redirect the merchant back to the redirect URL you specified, with a payload as described at the bottom of this page.
URL Query parameters
Construct the authorization URL with the parameters below.
client_id string (required)
client_id string (required)The client ID you received when you registered your OAuth app. The ID starts with
app_.
For example:app_j9Pakf56Ajta6Y65AkdTtAv.
redirect_uri string
redirect_uri stringThe URL the merchant is sent back to once the request has been authorized. If given, it must match the URL you set when registering your app.
state string (required)
state string (required)A random string generated by your app to prevent CSRF attacks. This will be reflected in the
statequery parameter when the user returns to theredirect_uriafter authorizing your app.
scope string (required)
scope string (required)A space-separated list of permissions ('scopes') your app requires. See the permissions list for more information about the available scopes.
Example:
organizations.read profiles.read payments.read payments.write
response_type string (required)
response_type string (required)The OAuth response type. We only support
coderesponses.Possible values:
code
approval_prompt string
approval_prompt stringCan be set to
forceto force showing the consent screen to the merchant, even when it is not necessary. If you force an approval prompt and the user creates a new authorization, previously active authorizations will be revoked.Possible values:
autoforce(default:auto)
locale string
locale stringPreset the language to be used for the login screen, if applicable. For the consent screen, the preferred language of the logged in merchant will be used and this parameter is ignored.
When this parameter is omitted, the browser language will be used instead.
Possible values:
en_USnl_NLnl_BEfr_FRfr_BEde_DEes_ESit_IT
landing_page string
landing_page stringSpecify if Mollie should show the login or the signup page, when the merchant is not logged in at Mollie.
Possible values:
loginsignup(default:login)
Processing the result
After you redirect the merchant to Mollie, they will proceed through the authorization steps on Mollie's side.
At the end of the flow, Mollie will redirect the merchant back to the redirect URL you specified. The following parameters will be attached to the redirect URL.
code
codeIf authorization succeeded, a code will be attached to the redirect URL. You can use this code to retrieve an access token from the Generate tokens endpoint.
state
stateThe state string you attached to the URL will be sent back to you. Please verify it to prevent CSRF attacks.
error
errorIf the authorization failed or your URL was invalid, the merchant will be redirected back to you with an error code.
For example:access_denied
error_description
error_descriptionIf an error occurred, this field will also be present with a description of the error.
For example:The user denied access to your application
Using the Mollie OAuth SDK
We have SDKs available to help simplify the integration. See below example.
<?php
// composer require mollie/oauth2-mollie-php
$provider = new \Mollie\OAuth2\Client\Provider\Mollie([
"clientId" => "app_j9Pakf56Ajta6Y65AkdTtAv",
"clientSecret" => "S5lTvMDTjl95HGnwYmsszDtbMp8QBE2lLcRJbD7I",
"redirectUri" => "https://example.org/oauth-redirect",
]);
$authorizationUrl = $provider->getAuthorizationUrl([
"scope" => [
\Mollie\OAuth2\Client\Provider\Mollie::SCOPE_ORGANIZATIONS_READ,
\Mollie\OAuth2\Client\Provider\Mollie::SCOPE_PAYMENTS_READ,
],
]);