{"title":"Get account holder consent","category":"default","creationDate":1776961628,"content":"<p>Adyen uses <a href=\"https:\/\/oauth.net\/2\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\" class=\"external-link no-image\">OAuth 2.0<\/a>, an open standard for authorization, to allow third-party applications to get an account holder's explicit consent to access their account data. This page explains how to get an account holder's consent to access their Adyen business account information.<\/p>\n<h2>Requirements<\/h2>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: left;\">Requirement<\/th>\n<th style=\"text-align: left;\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: left;\"><strong>Integration type<\/strong><\/td>\n<td style=\"text-align: left;\">Not applicable; this documentation is intended for third-party providers.<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: left;\"><strong>Setup steps<\/strong><\/td>\n<td style=\"text-align: left;\">Before you begin, you must complete the <a href=\"\/pt\/business-accounts\/open-banking#onboard-with-adyen\">Adyen onboarding steps<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>How it works<\/h2>\n<p>Here is how the OAuth flow works with Adyen open banking:<\/p>\n<ul>\n<li>In your client app, the account holder selects to give access to their payment data with Adyen.<\/li>\n<li>Your client app <a href=\"#redirect-account-holder-for-authentication\">redirects the account holder<\/a> to Adyen's authentication interface so they can authenticate and give their consent  to access their account data. Depending on the consent they give, you can check their account details, view the balance on their account, or initiate a payment.<\/li>\n<li>Adyen generates an authorization code and returns it to your client app through the redirect URL.<\/li>\n<li>Your server uses the authorization code to <a href=\"#get-an-access-token\">get an access token<\/a>. The access token is needed for two things:\n<ul>\n<li>To authenticate open banking requests to Adyen for this account holder.<\/li>\n<li>To get the account holder's consent ID, which is needed to get their account details.<\/li>\n<\/ul><\/li>\n<li>Your server uses the access token to <a href=\"#create-a-consent\">create a consent<\/a> and get a <code>consentId<\/code>.<\/li>\n<\/ul>\n<p>After you get the access token and the <code>consentId<\/code>, you can make requests to Adyen open banking APIs to retrieve the account holder's Adyen business account details.<\/p>\n<h2>Implement Adyen connect button<\/h2>\n<p>In your app or on your website, implement a <strong>Connect with Adyen<\/strong> button. This button sends a GET <code>\/bankoauth\/authorize<\/code> request to your server, which redirects the account holder to an Adyen dialog for authentication and consent. Use the URL from the next step to get the account holder's consent.<\/p>\n<h2>Redirect account holder for authentication<\/h2>\n<p>To redirect the account holder so they can authenticate and give consent:<\/p>\n<ol>\n<li>\n<p>Make a GET <code>\/bankoauth\/authorize<\/code> request with the following query parameters:<\/p>\n<p><div class=\"sc-notice info\"><div> Note that this request does not require any type of authorization.<\/div><\/div><\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>client_id<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Identifies the client (your app) making the request. This should match the QWAC certificate\u2019s organization identifier.<\/td>\n<\/tr>\n<tr>\n<td><code>response_type<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Specifies the response type expected from the authorization server. Set to <strong>code<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>redirect_uri<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Specifies the URI to which the authorization server redirects the user after authentication and consent.<\/td>\n<\/tr>\n<tr>\n<td><code>scope<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Defines the requested permissions or access levels that the client is seeking. It specifies the scope of the resources or actions the client intends to access on behalf of the user. Multiple scopes can be requested, separated by spaces.<br>Possible values: <strong>bank.aisp:read<\/strong>, <strong>bank.pisp:write<\/strong>, and <strong>bank.cof:read<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>code_challenge_method<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Set to <strong>S256<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>code_challenge<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>SHA256 hash of the <code>code_verifier<\/code> to be provided when <a href=\"#get-an-access-token\">getting the access token<\/a> in the next step. The code_verifier is a random string generated by the third-party provider.<\/td>\n<\/tr>\n<tr>\n<td><code>state<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>A string generated by the client, which is included in the request and returned by the authorization server. It helps maintain the integrity of the authorization flow by preventing CSRF attacks.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>By including these parameters, the authorization server can properly authenticate the account holder.<\/p>\n<p>Here is an example of a GET request:<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get authentication instructions for the account holder'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl  'https:\\\/\\\/balanceplatform-test.adyen.com\\\/bankoauth\\\/authorize?client_id={CLIENT_ID}&amp;code_challenge_method=S256&amp;code_challenge={CODE_CHALLENGE}&amp;response_type=code&amp;redirect_uri={REDIRECT_URI}&amp;state={STATE}&amp;scope={SCOPE}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>Embed the HTML code that you receive in the response into your app or website so the account holder can authenticate with their Adyen business account.<\/p>\n<\/li>\n<li>\n<p>After the account holder has authenticated, get the <code>code<\/code> that is sent back to your client's <code>redirect_uri<\/code>. You need this code in the next step, to get an access token. This redirect will include the following query parameters in the URL.<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>code<\/code><\/td>\n<td>The authorization code used to <a href=\"#get-an-access-token\">exchange for an access token<\/a>. The <code>code<\/code> is short-lived and expires in five minutes.<\/td>\n<\/tr>\n<tr>\n<td><code>state<\/code><\/td>\n<td>The same value as in the initial redirect URL.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>An example of a redirect URL may look like this:<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Redirect URL with authorization code'\" :id=\"''\" :code-data='[{\"language\":\"bash\",\"tabTitle\":\"\",\"content\":\"https:\\\/\\\/{redirect_uri}?code={code}&amp;state={state}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Get an access token<\/h2>\n<p>To exchange the authorization code from the previous step for an access token:<\/p>\n<ol>\n<li>\n<p>From the server, make a POST <code>\/token<\/code> request with the following parameters in the request body:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>grant_type<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Set to <strong>authorization_code<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>code<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The authorization code provided in the redirect URL.<\/td>\n<\/tr>\n<tr>\n<td><code>code_verifier<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The code verifier.<\/td>\n<\/tr>\n<tr>\n<td><code>redirect_uri<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The redirect URI for your client.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Authentication type<\/strong>: use <code>client_id<\/code> and <code>client_secret<\/code> for basic authentication.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Get access token'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl 'https:\\\/\\\/oauth-test.adyen.com\\\/v1\\\/token' \\\\\\n--header 'Authorization: Basic {BASE64(client_id:client_secret)}' \\\\\\n--header 'Content-Type: application\\\/x-www-form-urlencoded' \\\\\\n--data-urlencode 'grant_type=authorization_code' \\\\\\n--data-urlencode 'code={CODE}' \\\\\\n--data-urlencode 'code_verifier={CODE_VERIFIER}' \\\\\\n--data-urlencode 'redirect_uri={REDIRECT_URI}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>From the response, save the <code>access_token<\/code> and the <code>refresh_token<\/code>. You need the <code>access_token<\/code> in the next step, to get a <code>consentId<\/code>. The response contains the following fields:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>token_type<\/code><\/td>\n<td>The token type: <strong>bearer<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>expires_in<\/code><\/td>\n<td>The expiry of the access token, in seconds. By default, 24 hours.<\/td>\n<\/tr>\n<tr>\n<td><code>access_token<\/code><\/td>\n<td>The access token which can be used to access the open banking APIs.<\/td>\n<\/tr>\n<tr>\n<td><code>scope<\/code><\/td>\n<td>The scope for the <code>access_token<\/code>. Multiple scopes are possible, separated by spaces.<\/td>\n<\/tr>\n<tr>\n<td><code>refresh_token<\/code><\/td>\n<td>The OAuth refresh token that you can use to get new access tokens with the same scope. The refresh token expires as soon as it is used, providing a new access token and a new refresh token. A refresh token is one-time-use.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n    \\\"token_type\\\": \\\"bearer\\\",\\n    \\\"expires_in\\\": 86400,\\n    \\\"access_token\\\": \\\"oa_tzNbAuwtPQEogej95u5RH7sbYQ6ugQ2PQ5tp4IkuOqgI0iM\\\",\\n    \\\"scope\\\": \\\"bank.aisp:read bank.pisp:write\\\",\\n    \\\"accounts\\\": [\\n        \\\"NL57INGB4654188101\\\"\\n    ],\\n    \\\"refresh_token\\\": \\\"oa_6sL3R9KDN8zzC5XQ2WhtKr1AxXy0gvikcPo9i1CO6APU0PK\\\"\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<div class=\"notices green\">\n<p>If you lose the refresh token, there is no way to recover the granted access. You will need to <a href=\"#redirect-account-holder-for-authentication\">redirect the account holder for authentication<\/a> again.<\/p>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Create a consent<\/h2>\n<p>To create a new consent use the access token to get a <code>consentId<\/code>. This <code>consentId<\/code> is needed to get the account details for the account holder. This consent needs to be approved by the account holder to continue.<\/p>\n<ol>\n<li>\n<p>Make a POST <code>\/consents<\/code> request with the following parameters in the request body. The request header includes the <code>TPP-Signature-Certificate: QSEALCertificate<\/code>, which is the full eIDAS certificate encoded in Base64 format.<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>access<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The type of access requested. Set <code>allPsd2<\/code> to <strong>allAccounts<\/strong>. This means you are requesting access to all of the user's accounts with Adyen.<\/td>\n<\/tr>\n<tr>\n<td><code>recurringIndicator<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Indicates that the consent is being requested for recurring access to the user's account information or payment initiation.<\/td>\n<\/tr>\n<tr>\n<td><code>validUntil<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Specifies the consent's validity end date in YYYY-MM-DD (ISO format). Maximum 90-day duration and 10 uses per day. Consent expires after this date.<\/td>\n<\/tr>\n<tr>\n<td><code>frequencyPerDay<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Indicates the maximum number of times per day that you are allowed to access the user's account information or initiate payments.<\/td>\n<\/tr>\n<tr>\n<td><code>combinedServiceIndicator<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Indicates whether you are requesting access to the user's account information or payment initiation services individually or as a combined service.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Create a new consent'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl  'https:\\\/\\\/openbanking-psd2-test.adyen.com\\\/obeu\\\/consent\\\/v1\\\/consents' \\\\\\n--header 'X-Request-ID: {your-request-id}' \\\\\\n--header 'TPP-Signature-Certificate: QSEALCertificate' \\\\\\n--header 'Content-Type: application\\\/json' \\\\\\n--header 'Authorization: Bearer {access-token}' \\\\\\n--data '{\\n    \\&quot;access\\&quot; : {\\n        \\&quot;allPsd2\\&quot;: \\&quot;allAccounts\\&quot;\\n    },\\n    \\&quot;recurringIndicator\\&quot;: true,\\n    \\&quot;validUntil\\&quot;: \\&quot;2025-12-31\\&quot;,\\n    \\&quot;frequencyPerDay\\&quot;: 10,\\n    \\&quot;combinedServiceIndicator\\&quot;: false\\n}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>The response contains the <code>consentStatus<\/code>, <code>consentId<\/code>, and links to requested resources. From the response, save the <code>consentId<\/code>, you need this for the Adyen open banking requests to get the account details for this account holder. You can continue to poll the endpoint until you receive an updated <code>consentStatus<\/code>.<\/p>\n<ul>\n<li>If you want to get information about consent authorization and to determine where your account holder is in the authentication flow, you will need the <code>authorization-id-consent<\/code>. This is the last set of characters at the end of the<code>scaStatus<\/code> link below. Save this <code>authorization-id-consent<\/code> to use in the  <a href=\"\/pt\/business-accounts\/consent#check-the-authorization-status-of-an-account-holders-consent\">get authorization information<\/a>.<\/li>\n<\/ul>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Response'\" :id=\"''\" :code-data='[{\"language\":\"json\",\"tabTitle\":\"\",\"content\":\"{\\n  \\\"consentStatus\\\": \\\"received\\\",\\n  \\\"consentId\\\": \\\"09289d2e-83ae-4a61-8452-ac23cf0055de\\\",\\n  \\\"_links\\\": {\\n      \\\"self\\\": {\\n          \\\"href\\\": \\\"consent\\\/v1\\\/consents\\\/09289d2e-83ae-4a61-8452-ac23cf0055de\\\"\\n      },\\n      \\\"status\\\": {\\n          \\\"href\\\": \\\"consent\\\/v1\\\/consents\\\/09289d2e-83ae-4a61-8452-ac23cf0055de\\\/status\\\"\\n      },\\n      \\\"scaStatus\\\": {\\n          \\\"href\\\": \\\"consent\\\/v1\\\/consents\\\/09289d2e-83ae-4a61-8452-ac23cf0055de\\\/authorisations\\\/OBAU4222Z223222P5J6FP7BDG34LW3\\\"\\n      }\\n  }\\n}\"}]' :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<\/ol>\n<h2>Refresh an access token<\/h2>\n<p>Because the access token is short-lived, a new access token has to be requested regularly to continue using open banking APIs. To find your original refresh token, see the response from <a href=\"#get-an-access-token\">get an access token<\/a>. To refresh an access token:<\/p>\n<ol>\n<li>\n<p>Make a POST request to the <code>\/token<\/code> endpoint. Provide the following parameters in the request body:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th style=\"text-align: center;\">Required<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>grant_type<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>Set to <strong>refresh_token<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>refresh_token<\/code><\/td>\n<td style=\"text-align: center;\"><img title=\"-white_check_mark-\" alt=\"-white_check_mark-\" class=\"smileys\" src=\"\/user\/data\/smileys\/emoji\/white_check_mark.png\" \/><\/td>\n<td>The refresh token.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>Authentication type<\/strong>: use <code>client_id<\/code> and <code>client_secret<\/code> for basic authentication.<\/p>\n<div data-component-wrapper=\"code-sample\">\n<code-sample :title=\"'Refresh access token'\" :id=\"''\" :code-data=\"[{&quot;language&quot;:&quot;bash&quot;,&quot;tabTitle&quot;:&quot;&quot;,&quot;content&quot;:&quot;curl --request POST 'https:\\\/\\\/oauth-test.adyen.com\\\/v1\\\/token' \\\\\\n--header 'Authorization: Basic {BASE64(client_id:client_secret)}' \\\\\\n--header 'Content-Type: application\\\/x-www-form-urlencoded' \\\\\\n--data-urlencode 'grant_type=refresh_token' \\\\\\n--data-urlencode 'refresh_token={REFRESH_TOKEN}'&quot;}]\" :enable-copy-link-to-code-block=\"true\" :code-sample-card-size=\"'fullsize'\"><\/code-sample>\n<\/div>\n<\/li>\n<li>\n<p>From the response, save the new <code>access_token<\/code> and <code>refresh_token<\/code>. The response contains the following fields:<\/p>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>token_type<\/code><\/td>\n<td>The token type: <strong>bearer<\/strong>.<\/td>\n<\/tr>\n<tr>\n<td><code>expires_in<\/code><\/td>\n<td>The expiry of the access token, in seconds. By default, 24 hours.<\/td>\n<\/tr>\n<tr>\n<td><code>access_token<\/code><\/td>\n<td>The access token which can be used to access the open banking APIs.<\/td>\n<\/tr>\n<tr>\n<td><code>refresh_token<\/code><\/td>\n<td>The OAuth refresh token that you can use to get new access tokens with the same scope. The refresh token has an unlimited validity but it expires with a short grace period when the refresh token is used to renew the access token. A refresh token is one-time-use.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<pre><code class=\"language-json\">{\n   \"token_type\": \"bearer\",\n   \"expires_in\": 86400,\n   \"access_token\": \"oa_Elnme5TE0FH0v8qXEAQ56ME0Zxp0s1ETtGizd07mEY0MTh1\",\n   \"refresh_token\": \"oa_T7ZKiG5HsdTBAstDksw4WslQhbQQr0CwfSom90NkSV9w8zB\"\n}<\/code><\/pre>\n<\/li>\n<\/ol>","url":"https:\/\/docs.adyen.com\/pt\/business-accounts\/oauth-flow","articleFields":{"description":"Learn how to get an access and refresh token.","feedback_component":true,"id":"31504141","type":"page","_expandable":{"operations":""},"status":"current","next_steps":[{"title":"Consent interface","description":"Learn how to manage user consents with our dedicated endpoints.","url":"\/business-accounts\/consent","required":true},{"title":"AISP interface","description":"Learn how to consume our dedicated AISP endpoints.","url":"\/business-accounts\/aisp","required":false},{"title":"PISP interface","description":"Learn how to consume our dedicated PISP endpoints.","url":"\/business-accounts\/pisp","required":false},{"title":"PIISP interface","description":"Learn how to consume our dedicated PIISP endpoints.","url":"\/business-accounts\/piisp","required":false}],"parameters":{"directoryPath":"\/business-accounts","model":"balance platform"}},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/business-accounts\/oauth-flow","title":"Get account holder consent","content":"Adyen uses OAuth 2.0, an open standard for authorization, to allow third-party applications to get an account holder's explicit consent to access their account data. This page explains how to get an account holder's consent to access their Adyen business account information.\nRequirements\n\n\n\nRequirement\nDescription\n\n\n\n\nIntegration type\nNot applicable; this documentation is intended for third-party providers.\n\n\nSetup steps\nBefore you begin, you must complete the Adyen onboarding steps.\n\n\n\nHow it works\nHere is how the OAuth flow works with Adyen open banking:\n\nIn your client app, the account holder selects to give access to their payment data with Adyen.\nYour client app redirects the account holder to Adyen's authentication interface so they can authenticate and give their consent  to access their account data. Depending on the consent they give, you can check their account details, view the balance on their account, or initiate a payment.\nAdyen generates an authorization code and returns it to your client app through the redirect URL.\nYour server uses the authorization code to get an access token. The access token is needed for two things:\n\nTo authenticate open banking requests to Adyen for this account holder.\nTo get the account holder's consent ID, which is needed to get their account details.\n\nYour server uses the access token to create a consent and get a consentId.\n\nAfter you get the access token and the consentId, you can make requests to Adyen open banking APIs to retrieve the account holder's Adyen business account details.\nImplement Adyen connect button\nIn your app or on your website, implement a Connect with Adyen button. This button sends a GET \/bankoauth\/authorize request to your server, which redirects the account holder to an Adyen dialog for authentication and consent. Use the URL from the next step to get the account holder's consent.\nRedirect account holder for authentication\nTo redirect the account holder so they can authenticate and give consent:\n\n\nMake a GET \/bankoauth\/authorize request with the following query parameters:\n Note that this request does not require any type of authorization.\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\nclient_id\n\nIdentifies the client (your app) making the request. This should match the QWAC certificate\u2019s organization identifier.\n\n\nresponse_type\n\nSpecifies the response type expected from the authorization server. Set to code.\n\n\nredirect_uri\n\nSpecifies the URI to which the authorization server redirects the user after authentication and consent.\n\n\nscope\n\nDefines the requested permissions or access levels that the client is seeking. It specifies the scope of the resources or actions the client intends to access on behalf of the user. Multiple scopes can be requested, separated by spaces.Possible values: bank.aisp:read, bank.pisp:write, and bank.cof:read.\n\n\ncode_challenge_method\n\nSet to S256.\n\n\ncode_challenge\n\nSHA256 hash of the code_verifier to be provided when getting the access token in the next step. The code_verifier is a random string generated by the third-party provider.\n\n\nstate\n\nA string generated by the client, which is included in the request and returned by the authorization server. It helps maintain the integrity of the authorization flow by preventing CSRF attacks.\n\n\n\nBy including these parameters, the authorization server can properly authenticate the account holder.\nHere is an example of a GET request:\n\n\n\n\n\nEmbed the HTML code that you receive in the response into your app or website so the account holder can authenticate with their Adyen business account.\n\n\nAfter the account holder has authenticated, get the code that is sent back to your client's redirect_uri. You need this code in the next step, to get an access token. This redirect will include the following query parameters in the URL.\n\n\n\nParameter\nDescription\n\n\n\n\ncode\nThe authorization code used to exchange for an access token. The code is short-lived and expires in five minutes.\n\n\nstate\nThe same value as in the initial redirect URL.\n\n\n\nAn example of a redirect URL may look like this:\n\n\n\n\n\nGet an access token\nTo exchange the authorization code from the previous step for an access token:\n\n\nFrom the server, make a POST \/token request with the following parameters in the request body:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\ngrant_type\n\nSet to authorization_code.\n\n\ncode\n\nThe authorization code provided in the redirect URL.\n\n\ncode_verifier\n\nThe code verifier.\n\n\nredirect_uri\n\nThe redirect URI for your client.\n\n\n\nAuthentication type: use client_id and client_secret for basic authentication.\n\n\n\n\n\nFrom the response, save the access_token and the refresh_token. You need the access_token in the next step, to get a consentId. The response contains the following fields:\n\n\n\nParameter\nDescription\n\n\n\n\ntoken_type\nThe token type: bearer.\n\n\nexpires_in\nThe expiry of the access token, in seconds. By default, 24 hours.\n\n\naccess_token\nThe access token which can be used to access the open banking APIs.\n\n\nscope\nThe scope for the access_token. Multiple scopes are possible, separated by spaces.\n\n\nrefresh_token\nThe OAuth refresh token that you can use to get new access tokens with the same scope. The refresh token expires as soon as it is used, providing a new access token and a new refresh token. A refresh token is one-time-use.\n\n\n\n\n\n\n\nIf you lose the refresh token, there is no way to recover the granted access. You will need to redirect the account holder for authentication again.\n\n\n\nCreate a consent\nTo create a new consent use the access token to get a consentId. This consentId is needed to get the account details for the account holder. This consent needs to be approved by the account holder to continue.\n\n\nMake a POST \/consents request with the following parameters in the request body. The request header includes the TPP-Signature-Certificate: QSEALCertificate, which is the full eIDAS certificate encoded in Base64 format.\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\naccess\n\nThe type of access requested. Set allPsd2 to allAccounts. This means you are requesting access to all of the user's accounts with Adyen.\n\n\nrecurringIndicator\n\nIndicates that the consent is being requested for recurring access to the user's account information or payment initiation.\n\n\nvalidUntil\n\nSpecifies the consent's validity end date in YYYY-MM-DD (ISO format). Maximum 90-day duration and 10 uses per day. Consent expires after this date.\n\n\nfrequencyPerDay\n\nIndicates the maximum number of times per day that you are allowed to access the user's account information or initiate payments.\n\n\ncombinedServiceIndicator\n\nIndicates whether you are requesting access to the user's account information or payment initiation services individually or as a combined service.\n\n\n\n\n\n\n\n\nThe response contains the consentStatus, consentId, and links to requested resources. From the response, save the consentId, you need this for the Adyen open banking requests to get the account details for this account holder. You can continue to poll the endpoint until you receive an updated consentStatus.\n\nIf you want to get information about consent authorization and to determine where your account holder is in the authentication flow, you will need the authorization-id-consent. This is the last set of characters at the end of thescaStatus link below. Save this authorization-id-consent to use in the  get authorization information.\n\n\n\n\n\n\nRefresh an access token\nBecause the access token is short-lived, a new access token has to be requested regularly to continue using open banking APIs. To find your original refresh token, see the response from get an access token. To refresh an access token:\n\n\nMake a POST request to the \/token endpoint. Provide the following parameters in the request body:\n\n\n\nParameter\nRequired\nDescription\n\n\n\n\ngrant_type\n\nSet to refresh_token.\n\n\nrefresh_token\n\nThe refresh token.\n\n\n\nAuthentication type: use client_id and client_secret for basic authentication.\n\n\n\n\n\nFrom the response, save the new access_token and refresh_token. The response contains the following fields:\n\n\n\nParameter\nDescription\n\n\n\n\ntoken_type\nThe token type: bearer.\n\n\nexpires_in\nThe expiry of the access token, in seconds. By default, 24 hours.\n\n\naccess_token\nThe access token which can be used to access the open banking APIs.\n\n\nrefresh_token\nThe OAuth refresh token that you can use to get new access tokens with the same scope. The refresh token has an unlimited validity but it expires with a short grace period when the refresh token is used to renew the access token. A refresh token is one-time-use.\n\n\n\n{\n   \"token_type\": \"bearer\",\n   \"expires_in\": 86400,\n   \"access_token\": \"oa_Elnme5TE0FH0v8qXEAQ56ME0Zxp0s1ETtGizd07mEY0MTh1\",\n   \"refresh_token\": \"oa_T7ZKiG5HsdTBAstDksw4WslQhbQQr0CwfSom90NkSV9w8zB\"\n}\n\n","type":"page","locale":"pt","boost":18,"hierarchy":{"lvl0":"Home","lvl1":"Business accounts","lvl2":"Get account holder consent"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/business-accounts","lvl2":"\/pt\/business-accounts\/oauth-flow"},"levels":3,"category":"","category_color":"","tags":["account","holder","consent"]}}
