OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.
Once the user has granted you access to his account you will be able to get a token that can be use to access Qonto API on his behalf.
New to OAuth 2.0? Check out these generic guides before diving in:
Already have an API key? If you only need to automate your own Qonto account, you may not need OAuth at all. Check the authentication introduction to pick the right method for your use case.
Step by step
1
Authorize
The first step is to redirect the user to the Qonto OAuth server. The Qonto user will be invited to authenticate.
This URL must be opened by the end user’s own browser — never called by your backend or any HTTP client (curl, fetch, requests…). Your server only builds the URL string, then either redirects the user to it using an HTTP 302 status code or opens a pop-up with that URL. Calling this endpoint yourself (e.g. with curl) and forwarding the resulting redirect location to the user breaks the CSRF cookie binding tied to the browser session, and causes request_forbidden: No CSRF value available in the session cookie.
Typical integration pattern: the user visits a route on your app (e.g. GET /integrations/qonto/authorize). Your backend builds the authorization URL below and responds with an HTTP 302 redirect to it — the user’s browser then follows that redirect to Qonto.
Then they will have to allow your application to access one of the organizations they are part of.
If you need your integration to run unattended (e.g. automations, scheduled tasks), include offline_access in your scope parameter. Without it, you will not receive a refresh token and your integration will stop working after 1 hour.
CSRF protection with state: Generate a unique, unpredictable value (e.g. a random 32-byte hex string), include it in the authorization URL as state, and store it in the user’s session. When the user is redirected back to your redirect_uri, verify that the received state matches what you stored. Reject the flow if they differ — this protects against cross-site request forgery.
Optional: restrict org selection. You can pass organization_id to lock the flow to a specific organization, or registration_id to pre-select an org from the onboarding flow. In both cases the org selection screen is skipped.
What the Qonto user sees
Your app should include a “Connect with Qonto” button which should trigger this endpoint;
If you just want to connect your app to one single organization, you can just send the endpoint URL to the Qonto user from whom you need to get the consent.
After clicking on your button, the Qonto user will be redirected to Qonto and will have to authenticate;
(optional) The Qonto will have to select an organization;
The Qonto user will have to give their consent to your app for the organization they have just selected (or for the organization identified by the organization_id or the registration_id query parameter);
The Qonto user will be automatically redirected back to your redirect_uri.
cf. this endpoint for a full technical description of the query parameters.
These snippets only build the authorization URL string using each language’s URL-encoding library — they never call it. There is no cURL example here on purpose: cURL is a request tool, and issuing the request yourself (from your server) is exactly the mistake to avoid (see warning above).
Python
Node.js
import urllib.parseimport secretsstate = secrets.token_urlsafe(32) # store in session for CSRF verificationparams = { "client_id": "your-client-id", "redirect_uri": "https://your-app.com/callback", "response_type": "code", "scope": "offline_access organization.read", "state": state,}auth_url = "https://oauth.qonto.com/oauth2/auth?" + urllib.parse.urlencode(params)# Do not requests.get(auth_url) yourself. On your backend, respond to the# user's request with an HTTP 302 redirect to auth_url, e.g. in Flask:# return redirect(auth_url)
const crypto = require('crypto');const state = crypto.randomBytes(32).toString('hex'); // store in sessionconst params = new URLSearchParams({ client_id: 'your-client-id', redirect_uri: 'https://your-app.com/callback', response_type: 'code', scope: 'offline_access organization.read', state,});const authUrl = `https://oauth.qonto.com/oauth2/auth?${params.toString()}`;// Do not fetch(authUrl) yourself. On your backend, respond to the user's// request with an HTTP 302 redirect to authUrl, e.g. in Express:// res.redirect(authUrl)
After consent, Qonto redirects the user to your redirect_uri with a temporary code and the state you provided:
https://your-app.com/callback?code=AUTH_CODE&state=YOUR_STATE
400 invalid_grant
404
Invalid client_id or redirect_uri in the authorization request.
The client_id was not found. Double-check the value from your Developer Portal.
2
Exchange the authorization code for an access token
Once user has granted access to his account, he will be rederected to your application via your redirect_uri with a temporary authorization code.On your backend, you will have to exchange this code for an access_token.
Do not use Authorization: Basic headers. Qonto requires client_id and client_secret as form body parameters. Sending them in the header will result in an invalid_client error.
Never expose your client_secret on the client side — this call must be made from your backend.
The redirect_uri must exactly match the value registered with Qonto, including trailing slashes and query strings. Pass it as a plain string and let your HTTP library handle the form encoding — do not manually pre-encode it (e.g. avoid https%3A%2F%2F...). A mismatch causes invalid_grant.
To perform authenticated requests on the Qonto API, you will have to provide the access_token in the Authorization header, as describe in this example:
The access_token expires after 1 hour. Rather than restarting the entire OAuth flow, use the refresh_token to obtain a new one silently on your backend.
Refresh tokens are one-time use. Every refresh call invalidates the token you used and returns a new refresh_token in the response. You must store this new token immediately — using an old refresh token will result in an invalid_grant error. If two processes attempt to refresh the same token concurrently, the second request will always fail.
import requestsresponse = requests.post( "https://oauth.qonto.com/oauth2/token", data={ "grant_type": "refresh_token", "refresh_token": stored_refresh_token, "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", },)tokens = response.json()# Store both new tokens — the old refresh_token is now invalidatedaccess_token = tokens["access_token"]stored_refresh_token = tokens["refresh_token"]
const response = await fetch('https://oauth.qonto.com/oauth2/token', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({ grant_type: 'refresh_token', refresh_token: storedRefreshToken, client_id: 'YOUR_CLIENT_ID', client_secret: 'YOUR_CLIENT_SECRET', }),});const tokens = await response.json();// Store both new tokens — the old refresh_token is now invalidatedaccessToken = tokens.access_token;storedRefreshToken = tokens.refresh_token;
Token lifecycle at a glance:
Token
Lifetime
What to do when it expires
access_token
1 hour
Use refresh_token to get a new one — no user action needed
refresh_token
90 days
Restart the OAuth flow (user must re-authorize)
As long as you refresh before the 90-day window closes and correctly store the latest refresh_token after each call, your integration will run indefinitely without requiring user re-authorization.For full parameter details and error responses, see the Refresh token endpoint.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Qonto","colors":{"primary":"#0E0E0E","light":"#B0B0B0","dark":"#0E0E0E"},"logo":{"light":"https://mintcdn.com/qonto-6237c309/Op_emyzb5FlZ5x50/logo/qonto-developers-light.svg?fit=max\u0026auto=format\u0026n=Op_emyzb5FlZ5x50\u0026q=85\u0026s=a8ce932eeec004b77efe8c0f611c5c5d","dark":"https://mintcdn.com/qonto-6237c309/Op_emyzb5FlZ5x50/logo/qonto-developers-dark.svg?fit=max\u0026auto=format\u0026n=Op_emyzb5FlZ5x50\u0026q=85\u0026s=bae39034af9c6d95a7e2e1a84a3857af","href":"https://docs.qonto.com/"},"favicon":"https://mintcdn.com/qonto-6237c309/IZJ5MTjzXpp-Ln1p/favicon.png?fit=max\u0026auto=format\u0026n=IZJ5MTjzXpp-Ln1p\u0026q=85\u0026s=557b33e6df403e1a96ae4b380aa212aa","api":{"playground":{"display":"interactive"},"examples":{"defaults":"all","prefill":true}},"appearance":{"default":"light"},"background":{"color":{"dark":"#1d1d1b"}},"navbar":{"links":[{"href":"https://qonto.com/en/integrations?#search","label":"Integrations"}],"primary":{"type":"button","label":"Developer Portal","href":"https://developers.qonto.com/sign-in/"}},"footer":{"socials":{"x":"https://x.com/getqonto","linkedin":"https://www.linkedin.com/company/qonto","instagram":"https://www.instagram.com/qonto","facebook":"https://www.facebook.com/getqonto"}},"seo":{"metatags":{"application-name":"Qonto APIs","description":"Qonto provides 2 collections of REST APIs and a Sandbox environment to help you build integrations on top of Qonto accounts, transactions, memberships, etc; no matter what your use case is.","keywords":"qonto api, qonto api reference, qonto api doc"},"indexing":"all"},"fonts":{"heading":{"family":"PolySans","source":"https://mintlify-assets.b-cdn.net/fonts/polysans-neutral-b855437b9905fe21c922ad25ed73abdfe6a7a8f2445c6e418f7f41d6d95c061f.woff2","format":"woff2"},"body":{"family":"PolySans","source":"https://mintlify-assets.b-cdn.net/fonts/polysans-neutral-b855437b9905fe21c922ad25ed73abdfe6a7a8f2445c6e418f7f41d6d95c061f.woff2","format":"woff2"}},"contextual":{"options":["copy","view","assistant","chatgpt","claude"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"qonto-6237c309","hasAudioNarration":false,"actualSubdomain":"qonto-6237c309","customDomains":["docs.qonto.com"],"gitSource":{"type":"github","owner":"qonto-private","repo":"public-doc","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"thumbs":true,"edits":false,"issues":false},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b09a439ec6654799b433ddc","clientVersion":"0.0.4347","searchFilterCounts":[{"language":"default","tag":"API","count":245},{"language":"default","tag":"Business API","count":223},{"language":"default","tag":"Partnerships","count":85},{"language":"default","tag":"Embed Qonto in your product","count":78},{"language":"default","tag":"Embed TypeScript SDK","count":61},{"language":"default","tag":"MCP","count":56},{"language":"default","tag":"Invoicing","count":53},{"language":"default","tag":"Guides","count":36},{"language":"default","tag":"Transfers","count":34},{"language":"default","tag":"Resources","count":34}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"td code{overflow-wrap:normal}"}]}
{"page":{"pagePath":"guides/authentication/oauth-flow","slug":"/guides/authentication/oauth-flow","pageMetadata":{"title":"The OAuth flow","description":"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for [specific permissions](/api-reference/business-api/introduction/authentication/scopes) that the user will be able to review and validate.","href":"/guides/authentication/oauth-flow"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx, jsxs: _jsxs} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n a: \"a\",\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsxs(_components.p, {\n children: [\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for \", _jsx(_components.a, {\n href: \"/api-reference/business-api/introduction/authentication/scopes\",\n children: \"specific permissions\"\n }), \" that the user will be able to review and validate.\"]\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,img:`img`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Accordion,CodeBlock,Heading,Info,Note,Step,Steps,Tab,Table,Tabs,Warning}=_components;if(!Accordion)_missingMdxReference(`Accordion`,true);if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Step)_missingMdxReference(`Step`,true);if(!Steps)_missingMdxReference(`Steps`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Once the user has granted you access to his account you will be able to get a token that can be use to access Qonto API on his behalf.`}),`\n`,_jsxs(Info,{children:[_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`New to OAuth 2.0?`}),` Check out these generic guides before diving in:`]}),_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`https://www.youtube.com/watch?v=ZV5yTm4pT8g`,children:`OAuth 2 Explained In Simple Terms`}),` — ByteByteGo video (4:30)`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`https://auth0.com/intro-to-iam/what-is-oauth-2`,children:`What is OAuth 2.0?`}),` — Auth0 written guide`]}),`\n`]})]}),`\n`,_jsx(Info,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Already have an API key?`}),` If you only need to automate your own Qonto account, you may not need OAuth at all. Check the `,_jsx(_components.a,{href:`/api-reference/business-api/introduction/authentication/methods`,children:`authentication introduction`}),` to pick the right method for your use case.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`step-by-step`,children:`Step by step`}),`\n`,_jsx(_components.p,{children:_jsx(_components.img,{src:`https://qonto-assets.s3.eu-central-1.amazonaws.com/oauth-clients/oauth_flow.png`,alt:`Oauth 2 flow`,title:`OAuth 2.0 authentication flow`})}),`\n`,_jsxs(Steps,{titleSize:`h3`,children:[_jsxs(Step,{title:`Authorize`,id:`authorize`,children:[_jsx(_components.p,{children:`The first step is to redirect the user to the Qonto OAuth server. The Qonto user will be invited to authenticate.`}),_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`This URL must be opened by the end user’s own browser — never called by your backend or any HTTP client (`,_jsx(_components.code,{children:`curl`}),`, `,_jsx(_components.code,{children:`fetch`}),`, `,_jsx(_components.code,{children:`requests`}),`…).`]}),` Your server only builds the URL string, then either redirects the user to it using an HTTP `,_jsx(_components.code,{children:`302`}),` status code or opens a pop-up with that URL. Calling this endpoint yourself (e.g. with `,_jsx(_components.code,{children:`curl`}),`) and forwarding the resulting redirect location to the user breaks the CSRF cookie binding tied to the browser session, and causes `,_jsx(_components.code,{children:`request_forbidden: No CSRF value available in the session cookie`}),`.`]})}),_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Typical integration pattern:`}),` the user visits a route on `,_jsx(_components.em,{children:`your`}),` app (e.g. `,_jsx(_components.code,{children:`GET /integrations/qonto/authorize`}),`). Your backend builds the authorization URL below and responds with an HTTP `,_jsx(_components.code,{children:`302`}),` redirect to it — the user’s browser then follows that redirect to Qonto.`]})}),_jsx(_components.p,{children:_jsx(_components.img,{src:`https://qonto-assets.s3.eu-central-1.amazonaws.com/oauth-clients/flow/OAuth-login-screen.png`,alt:`Oauth 2 flow`,title:`User login`})}),_jsx(_components.p,{children:`Then they will have to allow your application to access one of the organizations they are part of.`}),_jsx(_components.p,{children:_jsx(_components.img,{src:`https://qonto-assets.s3.eu-central-1.amazonaws.com/oauth-clients/flow/OAuth-consent-screen.png`,alt:`Oauth 2 flow`,title:`User consent`})}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`If you need your integration to run unattended (e.g. automations, scheduled tasks), include `,_jsx(_components.code,{children:`offline_access`}),` in your `,_jsx(_components.code,{children:`scope`}),` parameter. Without it, you will not receive a refresh token and your integration will stop working after 1 hour.`]})}),_jsx(Info,{children:_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`CSRF protection with `,_jsx(_components.code,{children:`state`}),`:`]}),` Generate a unique, unpredictable value (e.g. a random 32-byte hex string), include it in the authorization URL as `,_jsx(_components.code,{children:`state`}),`, and store it in the user’s session. When the user is redirected back to your `,_jsx(_components.code,{children:`redirect_uri`}),`, verify that the received `,_jsx(_components.code,{children:`state`}),` matches what you stored. Reject the flow if they differ — this protects against cross-site request forgery.`]})}),_jsx(Note,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Optional: restrict org selection.`}),` You can pass `,_jsx(_components.code,{children:`organization_id`}),` to lock the flow to a specific organization, or `,_jsx(_components.code,{children:`registration_id`}),` to pre-select an org from the onboarding flow. In both cases the org selection screen is skipped.`]})}),_jsxs(Accordion,{title:`What the Qonto user sees`,id:`what-the-qonto-user-sees`,children:[_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Your app should include a “Connect with Qonto” button which should trigger this endpoint;`}),`\n`]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`If you are triggering this endpoint on the Sandbox environment (`,_jsx(_components.a,{href:`https://oauth-sandbox.staging.qonto.co`,children:`https://oauth-sandbox.staging.qonto.co`}),`), please make sure to be logged in on the `,_jsx(_components.a,{href:`https://sandbox.staging.qonto.co/devportal`,children:`Sandbox web-app`}),` first through your `,_jsx(_components.a,{href:`https://developers.qonto.com/`,children:`Developer Portal`}),` account.`]})}),_jsx(Info,{children:_jsx(_components.p,{children:`If you just want to connect your app to one single organization, you can just send the endpoint URL to the Qonto user from whom you need to get the consent.`})}),_jsxs(_components.ol,{start:`2`,children:[`\n`,_jsx(_components.li,{children:`After clicking on your button, the Qonto user will be redirected to Qonto and will have to authenticate;`}),`\n`,_jsx(_components.li,{children:`(optional) The Qonto will have to select an organization;`}),`\n`,_jsxs(_components.li,{children:[`The Qonto user will have to give their consent to your app for the organization they have just selected (or for the organization identified by the `,_jsx(_components.code,{children:`organization_id`}),` or the `,_jsx(_components.code,{children:`registration_id`}),` query parameter);`]}),`\n`,_jsxs(_components.li,{children:[`The Qonto user will be automatically redirected back to your `,_jsx(_components.code,{children:`redirect_uri`}),`.`]}),`\n`]})]}),_jsxs(_components.p,{children:[`cf. `,_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/retrieve_authorization`,children:`this endpoint`}),` for a full technical description of the query parameters.`]}),_jsx(Info,{children:_jsxs(_components.p,{children:[`These snippets only `,_jsx(_components.strong,{children:`build`}),` the authorization URL string using each language’s URL-encoding library — they never call it. There is no cURL example here on purpose: cURL is a request tool, and issuing the request yourself (from your server) is exactly the mistake to avoid (see warning above).`]})}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`Python`,id:`python`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`17`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`17`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` urllib.parse`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` secrets`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`state `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` secrets.token_urlsafe(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# store in session for CSRF verification`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`params `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-client-id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"redirect_uri\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://your-app.com/callback\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"response_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"scope\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"offline_access organization.read\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"state\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: state,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`auth_url `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://oauth.qonto.com/oauth2/auth?\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` +`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` urllib.parse.urlencode(params)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Do not requests.get(auth_url) yourself. On your backend, respond to the`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# user's request with an HTTP 302 redirect to auth_url, e.g. in Flask:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# return redirect(auth_url)`})}),`\n`]})})})}),_jsx(Tab,{title:`Node.js`,id:`node-js`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`16`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` crypto`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` require`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'crypto'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` state`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` crypto`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`randomBytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`32`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`).`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toString`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'hex'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// store in session`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` params`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URLSearchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'your-client-id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` redirect_uri:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://your-app.com/callback'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response_type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'code'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` scope:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'offline_access organization.read'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` state`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` authUrl`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `https://oauth.qonto.com/oauth2/auth?\"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`params`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`toString`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#D4D4D4`},children:`()`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Do not fetch(authUrl) yourself. On your backend, respond to the user's`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// request with an HTTP 302 redirect to authUrl, e.g. in Express:`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// res.redirect(authUrl)`})}),`\n`]})})})})]}),_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`After consent`}),`, Qonto redirects the user to your `,_jsx(_components.code,{children:`redirect_uri`}),` with a temporary `,_jsx(_components.code,{children:`code`}),` and the `,_jsx(_components.code,{children:`state`}),` you provided:\n`,_jsx(_components.code,{children:`https://your-app.com/callback?code=AUTH_CODE\u0026state=YOUR_STATE`})]}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`400 invalid_grant`,id:`400-invalid_grant`,children:_jsxs(_components.p,{children:[`Invalid `,_jsx(_components.code,{children:`client_id`}),` or `,_jsx(_components.code,{children:`redirect_uri`}),` in the authorization request.`]})}),_jsx(Tab,{title:`404`,id:`404`,children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`client_id`}),` was not found. Double-check the value from your Developer Portal.`]})})]})]}),_jsxs(Step,{title:`Exchange the authorization code for an access token`,id:`exchange-the-authorization-code-for-an-access-token`,children:[_jsxs(_components.p,{children:[`Once user has granted access to his account, he will be rederected to your application via your `,_jsx(_components.code,{children:`redirect_uri`}),` with a temporary authorization code.`]}),_jsxs(_components.p,{children:[`On your backend, you will have to exchange this code for an `,_jsx(_components.code,{children:`access_token`}),`.`]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsxs(_components.strong,{children:[`Do not use `,_jsx(_components.code,{children:`Authorization: Basic`}),` headers.`]}),` Qonto requires `,_jsx(_components.code,{children:`client_id`}),` and `,_jsx(_components.code,{children:`client_secret`}),` as form body parameters. Sending them in the header will result in an `,_jsx(_components.code,{children:`invalid_client`}),` error.`]})}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`Never expose your `,_jsx(_components.code,{children:`client_secret`}),` on the client side — this call must be made from your backend.`]})}),_jsx(Warning,{children:_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`redirect_uri`}),` must exactly match the value registered with Qonto, including trailing slashes and query strings. Pass it as a plain string and let your HTTP library handle the form encoding — do not manually pre-encode it (e.g. avoid `,_jsx(_components.code,{children:`https%3A%2F%2F...`}),`). A mismatch causes `,_jsx(_components.code,{children:`invalid_grant`}),`.`]})}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`cURL`,id:`curl`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://oauth.qonto.com/oauth2/token`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type: application/x-www-form-urlencoded'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'grant_type=authorization_code'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'code=YOUR_CODE'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'client_id=YOUR_CLIENT_ID'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'client_secret=YOUR_CLIENT_SECRET'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'redirect_uri=https://your-app.com/callback'`})]}),`\n`]})})})}),_jsx(Tab,{title:`Python`,id:`python-2`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`17`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`17`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Verify state matches what you stored in the session before proceeding`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://oauth.qonto.com/oauth2/token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"grant_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"authorization_code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"code\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: code, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# received in redirect_uri callback`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-client-id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client_secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-client-secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"redirect_uri\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://your-app.com/callback\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`access_token `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tokens[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"access_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`refresh_token `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tokens[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"refresh_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`] `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# requires offline_access scope`})]}),`\n`]})})})}),_jsx(Tab,{title:`Node.js`,id:`node-js-2`,children:_jsx(CodeBlock,{filename:``,numberOfLines:`15`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`15`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Verify state matches what you stored in the session before proceeding`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://oauth.qonto.com/oauth2/token'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/x-www-form-urlencoded'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URLSearchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` grant_type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'authorization_code'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` code`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// received in redirect_uri callback`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'your-client-id'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_secret:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'your-client-secret'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` redirect_uri:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://your-app.com/callback'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`access_token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`refresh_token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// refresh_token requires offline_access scope`})}),`\n`]})})})})]}),_jsxs(_components.p,{children:[`The response contains an `,_jsx(_components.code,{children:`access_token`}),` (valid `,_jsx(_components.strong,{children:`1 hour`}),`) and, if `,_jsx(_components.code,{children:`offline_access`}),` was requested, a `,_jsx(_components.code,{children:`refresh_token`}),` (valid `,_jsx(_components.strong,{children:`90 days`}),`).`]}),_jsx(Note,{children:_jsxs(_components.p,{children:[`Store the `,_jsx(_components.code,{children:`refresh_token`}),` securely — use it to obtain new access tokens without user interaction. See the `,_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/create_tokens`,children:`Refresh token endpoint`}),`.`]})}),_jsx(Heading,{level:`3`,id:`error-responses`,children:`Error responses`}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`400 invalid_request`,id:`400-invalid_request`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Causes:`}),` Missing required parameter (`,_jsx(_components.code,{children:`code`}),`, `,_jsx(_components.code,{children:`client_id`}),`, `,_jsx(_components.code,{children:`client_secret`}),`, `,_jsx(_components.code,{children:`redirect_uri`}),`, or `,_jsx(_components.code,{children:`grant_type`}),`), or wrong `,_jsx(_components.code,{children:`Content-Type`}),` header (must be `,_jsx(_components.code,{children:`application/x-www-form-urlencoded`}),`).`]})}),_jsx(Tab,{title:`400 invalid_client`,id:`400-invalid_client`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Causes:`}),` Wrong `,_jsx(_components.code,{children:`client_id`}),` or `,_jsx(_components.code,{children:`client_secret`}),`, or credentials sent via an `,_jsx(_components.code,{children:`Authorization: Basic`}),` header instead of as form body parameters.`]})}),_jsx(Tab,{title:`400 invalid_grant`,id:`400-invalid_grant-2`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Causes:`}),` Authorization code expired (10-minute TTL), code already used, or `,_jsx(_components.code,{children:`redirect_uri`}),` does not exactly match the registered value.`]})}),_jsx(Tab,{title:`400 invalid_scope`,id:`400-invalid_scope`,children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Causes:`}),` One or more of the requested scopes are not activated on your OAuth application.`]})})]}),_jsxs(_components.p,{children:[`cf. `,_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/create_tokens`,children:`API reference`}),` for full parameter details.`]})]}),_jsxs(Step,{title:`Use your access token (Bearer token)`,id:`use-your-access-token-bearer-token`,children:[_jsxs(_components.p,{children:[`To perform authenticated requests on the Qonto API, you will have to provide the `,_jsx(_components.code,{children:`access_token`}),` in the `,_jsx(_components.code,{children:`Authorization`}),` header, as describe in this example:`]}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`cURL`,id:`curl-2`,children:_jsx(CodeBlock,{filename:``,highlight:`[4]`,numberOfLines:`4`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`4`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` GET`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'https://thirdparty.qonto.com/organization'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --header`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Accept: application/json'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --header`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type: application/json'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` --header`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Authorization: Bearer YOUR_ACCESS_TOKEN'`})]}),`\n`]})})})}),_jsx(Tab,{title:`Python`,id:`python-3`,children:_jsx(CodeBlock,{filename:``,highlight:`[5]`,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.get(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://thirdparty.qonto.com/organization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` headers`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Authorization\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`f`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Bearer `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`access_token`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`},`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`organization `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json()`})]}),`\n`]})})})}),_jsx(Tab,{title:`Node.js`,id:`node-js-3`,children:_jsx(CodeBlock,{filename:``,highlight:`[3]`,numberOfLines:`6`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://thirdparty.qonto.com/organization'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` Authorization:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\" `Bearer \"}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:\"${\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`access_token`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:\"`\"}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:`organization`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`]})})})})]})]}),_jsxs(Step,{title:`Refresh your access token`,id:`refresh-your-access-token`,children:[_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`access_token`}),` expires after `,_jsx(_components.strong,{children:`1 hour`}),`. Rather than restarting the entire OAuth flow, use the `,_jsx(_components.code,{children:`refresh_token`}),` to obtain a new one silently on your backend.`]}),_jsx(Warning,{children:_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Refresh tokens are one-time use.`}),` Every refresh call invalidates the token you used and returns a new `,_jsx(_components.code,{children:`refresh_token`}),` in the response. You must store this new token immediately — using an old refresh token will result in an `,_jsx(_components.code,{children:`invalid_grant`}),` error. If two processes attempt to refresh the same token concurrently, the second request will always fail.`]})}),_jsxs(Tabs,{children:[_jsx(Tab,{title:`cURL`,id:`curl-3`,children:_jsx(CodeBlock,{filename:``,highlight:`[3,5]`,numberOfLines:`7`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` https://oauth.qonto.com/oauth2/token`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Content-Type: application/x-www-form-urlencoded'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'grant_type=refresh_token'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'Accept: application/json'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'refresh_token=YOUR_REFRESH_TOKEN'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'client_id=YOUR_CLIENT_ID'`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'client_secret=YOUR_CLIENT_SECRET'`})]}),`\n`]})})})}),_jsx(Tab,{title:`Python`,id:`python-4`,children:_jsx(CodeBlock,{filename:``,highlight:`[6,7]`,numberOfLines:`15`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`15`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`import`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`response `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` requests.post(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://oauth.qonto.com/oauth2/token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"grant_type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"refresh_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"refresh_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: stored_refresh_token,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client_id\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_CLIENT_ID\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"client_secret\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_CLIENT_SECRET\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`tokens `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` response.json()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Store both new tokens — the old refresh_token is now invalidated`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`access_token `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tokens[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"access_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`stored_refresh_token `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` tokens[`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"refresh_token\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]`})]}),`\n`]})})})}),_jsx(Tab,{title:`Node.js`,id:`node-js-4`,children:_jsx(CodeBlock,{filename:``,highlight:`[5,6]`,numberOfLines:`14`,language:`javascript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`javascript`,children:_jsxs(_components.code,{language:`javascript`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` response`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` fetch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'https://oauth.qonto.com/oauth2/token'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` method:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'POST'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` headers:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Content-Type'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'application/x-www-form-urlencoded'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` },`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` body:`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` new`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` URLSearchParams`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`({`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` grant_type:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'refresh_token'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line line-highlight`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` refresh_token:`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` storedRefreshToken`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_id:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_CLIENT_ID'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` client_secret:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` 'YOUR_CLIENT_SECRET'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }),`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` tokens`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` response`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`json`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// Store both new tokens — the old refresh_token is now invalidated`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`accessToken`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tokens`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`access_token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`storedRefreshToken`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` tokens`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`refresh_token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`]})})})})]}),_jsx(_components.p,{children:_jsx(_components.strong,{children:`Token lifecycle at a glance:`})}),_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Token`}),_jsx(_components.th,{children:`Lifetime`}),_jsx(_components.th,{children:`What to do when it expires`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`access_token`})}),_jsx(_components.td,{children:`1 hour`}),_jsxs(_components.td,{children:[`Use `,_jsx(_components.code,{children:`refresh_token`}),` to get a new one — no user action needed`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`refresh_token`})}),_jsx(_components.td,{children:`90 days`}),_jsx(_components.td,{children:`Restart the OAuth flow (user must re-authorize)`})]})]})]}),_jsxs(_components.p,{children:[`As long as you refresh before the 90-day window closes and correctly store the latest `,_jsx(_components.code,{children:`refresh_token`}),` after each call, your integration will run indefinitely without requiring user re-authorization.`]}),_jsxs(_components.p,{children:[`For full parameter details and error responses, see the `,_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/create_tokens`,children:`Refresh token endpoint`}),`.`]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`resources`,children:`Resources`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`If you need to understand better the OAuth flow: `,_jsx(_components.a,{href:`https://www.postman.com/qontoteam/workspace/qonto-public-api/flow/666c37ad3a6c630032f5b496`,children:_jsx(_components.strong,{children:`Postman visual flow`})}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`If you need more details about OAuth 2.0: `,_jsx(_components.a,{href:`https://oauth.net/2/`,children:_jsx(_components.strong,{children:`Official documentation`})}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Testing in the sandbox? See the `,_jsx(_components.a,{href:`/guides/authentication/oauth-sandbox`,children:_jsx(_components.strong,{children:`Sandbox guide`})}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`related-endpoints`,children:`Related endpoints`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/create_tokens`,children:`Create or refresh tokens`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/retrieve_authorization`,children:`Retrieve an authorization code`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/api-reference/business-api/authentication/oauth2/revoke-oauth-consents`,children:`Revoke consents`})}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"The OAuth flow","description":"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for [specific permissions](/api-reference/business-api/introduction/authentication/scopes) that the user will be able to review and validate.","href":"/guides/authentication/oauth-flow"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Step by step","slug":"step-by-step","depth":2,"children":[{"title":"Authorize","slug":"authorize","depth":3,"children":[]},{"title":"Exchange the authorization code for an access token","slug":"exchange-the-authorization-code-for-an-access-token","depth":3,"children":[]},{"title":"Error responses","slug":"error-responses","depth":3,"children":[]},{"title":"Use your access token (Bearer token)","slug":"use-your-access-token-bearer-token","depth":3,"children":[]},{"title":"Refresh your access token","slug":"refresh-your-access-token","depth":3,"children":[]}]},{"title":"Resources","slug":"resources","depth":2,"children":[]},{"title":"Related endpoints","slug":"related-endpoints","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/qonto-6237c309/825d995cd157b7a6/zendesk-widget.js"],"subdomain":"qonto-6237c309","siteName":"Qonto","title":"The OAuth flow - Qonto","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-12T11:10:01.633Z","originalFileLocation":"guides/authentication/oauth-flow.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.\">\u003cmeta data-mint-head name=\"keywords\" content=\"qonto api, qonto api reference, qonto api doc\">\u003cmeta data-mint-head name=\"application-name\" content=\"Qonto\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"The OAuth flow - Qonto\">\u003cmeta data-mint-head property=\"og:description\" content=\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Qonto\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.qonto.com/guides/authentication/oauth-flow\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://qonto-6237c309.mintlify.site/_mintlify/api/og/v2?division=Authentication\u0026amp;title=The+OAuth+flow\u0026amp;description=OAuth+2.0+is+a+protocol+that+lets+your+app+request+access+to+a+Qonto+user+account+without+getting+their+password.+Your+app+can+ask+for+%5Bspecific+permissions%5D%28%2Fa\u0026amp;theme=de8daa248a116ea6c770b0a2\u0026amp;signature=42f8575f30c5ff08458b3ef954f073dcd1fdbf634fd8baf8468f210ec27e7dc0\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"The OAuth flow - Qonto\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://qonto-6237c309.mintlify.site/_mintlify/api/og/v2?division=Authentication\u0026amp;title=The+OAuth+flow\u0026amp;description=OAuth+2.0+is+a+protocol+that+lets+your+app+request+access+to+a+Qonto+user+account+without+getting+their+password.+Your+app+can+ask+for+%5Bspecific+permissions%5D%28%2Fa\u0026amp;theme=de8daa248a116ea6c770b0a2\u0026amp;signature=42f8575f30c5ff08458b3ef954f073dcd1fdbf634fd8baf8468f210ec27e7dc0\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/qonto-6237c309/-JBBMXOClYmTjqns/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Qonto\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E0E0E\">\u003cmeta data-mint-head name=\"application-name\" content=\"Qonto APIs\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.qonto.com/guides/authentication/oauth-flow\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/authentication/oauth-flow.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.qonto.com/#organization\",\"name\":\"Qonto\",\"url\":\"https://docs.qonto.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/qonto-6237c309/Op_emyzb5FlZ5x50/logo/qonto-developers-light.svg?fit=max\u0026auto=format\u0026n=Op_emyzb5FlZ5x50\u0026q=85\u0026s=a8ce932eeec004b77efe8c0f611c5c5d\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.qonto.com#website\",\"name\":\"Qonto\",\"url\":\"https://docs.qonto.com\",\"publisher\":{\"@id\":\"https://docs.qonto.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.qonto.com/guides/authentication/oauth-flow#webpage\",\"url\":\"https://docs.qonto.com/guides/authentication/oauth-flow\",\"name\":\"The OAuth flow\",\"description\":\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.\",\"dateModified\":\"2026-11-12T11:10:01.633Z\",\"isPartOf\":{\"@id\":\"https://docs.qonto.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.qonto.com/guides/authentication/oauth-flow#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.qonto.com/guides/authentication/oauth-flow#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Qonto\",\"item\":\"https://docs.qonto.com\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The OAuth flow\",\"item\":\"https://docs.qonto.com/guides/authentication/oauth-flow\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.qonto.com/guides/authentication/oauth-flow#article\",\"headline\":\"The OAuth flow\",\"name\":\"The OAuth flow\",\"description\":\"OAuth 2.0 is a protocol that lets your app request access to a Qonto user account without getting their password. Your app can ask for specific permissions that the user will be able to review and validate.\",\"url\":\"https://docs.qonto.com/guides/authentication/oauth-flow\",\"mainEntityOfPage\":{\"@id\":\"https://docs.qonto.com/guides/authentication/oauth-flow#webpage\"},\"dateModified\":\"2026-11-12T11:10:01.633Z\",\"publisher\":{\"@id\":\"https://docs.qonto.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.qonto.com#website\"}}]}\u003c/script>","agentPointerHref":"/guides/authentication/oauth-flow.md","siteName":"Qonto","nav":{"global":null,"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":""}]},{"tab":"Guides","icon":"book-open","menu":[{"item":"Technical guides","icon":"compass","groups":[{"group":"Technical guides","pages":[{"title":"Guides","sidebarTitle":"Overview","href":"/guides"}]},{"group":"Developer Portal","pages":[{"title":"Create my OAuth App","href":"/guides/developer-portal/create-oauth-app"},{"title":"Developer guidelines","mode":"wide","href":"/guides/developer-portal/developer-guidelines"},{"title":"Accessing the Sandbox environment","href":"/guides/developer-portal/sandbox-access"}]},{"group":"Sandbox","pages":[{"title":"Testing in the Sandbox","href":"/guides/authentication/oauth-sandbox"},{"title":"How to enable SDD Collections in the Sandbox","description":"Set up SEPA Direct Debit Collections eligibility and complete the activation flow in the Sandbox environment using the QA tool.","href":"/guides/sandbox/enable-sdd-collections"}]},{"group":"Authentication","pages":[{"title":"The OAuth flow","href":"/guides/authentication/oauth-flow"},{"title":"The User OAuth flow","description":"The User OAuth flow lets you build an integration that can access multiple Qonto organizations belonging to the same user.","href":"/guides/authentication/user-oauth-flow"},{"title":"API key","href":"/guides/authentication/api-key"},{"title":"TPP identification through PSD2 QSeal certificate","href":"/guides/authentication/qsealc"},{"title":"Strong Customer Authentication","href":"/guides/authentication/sca-flows"}]},{"group":"PSD2","pages":[{"title":"How to make a transfer with PSD2","sidebarTitle":"Make a transfer with PSD2","href":"/guides/psd2/make-a-transfer"}]},{"group":"Webhooks","pages":[{"title":"Overview","href":"/guides/webhooks/overview"},{"title":"Setup","href":"/guides/webhooks/setup"},{"title":"Supported webhook events","sidebarTitle":"Supported events","href":"/guides/webhooks/supported-events"},{"title":"Test with webhook.site","href":"/guides/webhooks/testing"},{"title":"Troubleshooting","href":"/guides/webhooks/troubleshooting"}]},{"group":"Payments concepts","pages":[{"title":"Verification of Payee","href":"/guides/payments/verification-of-payee"},{"title":"International transfers","href":"/guides/payments/international-transfers"},{"title":"Collect payments with SEPA Direct Debit","href":"/guides/payments/sepa-direct-debit"},{"title":"Getting paid with payment links","href":"/guides/payments/payment-links"},{"title":"Accepting in-person payments with terminals","href":"/guides/payments/terminals"}]},{"group":"Invoicing","pages":[{"title":"E-invoicing via API","href":"/guides/invoicing/e-invoicing"},{"title":"Factur-X Invoices","href":"/guides/invoicing/factur-x"},{"title":"Payment Reminders","href":"/guides/invoicing/reminders"}]},{"group":"Partner mechanisms","pages":[{"title":"Proxy API requests from the Embed SDK","href":"/guides/partner-mechanisms/encoded-requests"},{"title":"Authenticate your end customers to Hosted Pages","href":"/guides/partner-mechanisms/embed-auth-links"}]},{"group":"Migrations","pages":[{"title":"Migrate to GET /v2/organization","href":"/guides/migrations/deprecated-organization-endpoints"}]},{"group":"Troubleshooting","pages":[{"title":"Troubleshooting","href":"/guides/troubleshooting"}]}]},{"item":"Use cases","icon":"briefcase","pages":[{"title":"Use cases","href":"/guides/use-cases"}]}]},{"tab":"API","icon":"code","pages":[{"title":"API","href":"/api-reference/business-api/introduction/overview"}]},{"tab":"MCP","icon":"robot","pages":[{"title":"MCP","href":"/mcp/overview"}]},{"tab":"Resources","icon":"toolbox","menu":[{"item":"CLI","icon":"terminal","pages":[{"title":"CLI","href":"/cli/overview"}]},{"item":"FAQs","icon":"circle-question","pages":[{"title":"FAQs","href":"/faq-articles/faq-home"}]},{"item":"Support","icon":"life-ring","pages":[{"title":"Support","href":"/support"}]},{"item":"Security \u0026 compliance","icon":"shield-halved","pages":[{"title":"Security \u0026 compliance","href":"/security-and-compliance/security-measures"}]}],"pages":[{"title":"Resources","href":"/cli/overview"}]},{"tab":"Partnerships","icon":"handshake","menu":[{"item":"Integrations with Qonto","icon":"puzzle-piece","pages":[{"title":"Integrations with Qonto","href":"/partnerships/integrations"}]},{"item":"Embed Qonto in your product","icon":"link","pages":[{"title":"Embed Qonto in your product","href":"/partnerships/embed/overview"}]},{"item":"Company creation","icon":"building","pages":[{"title":"Company creation","href":"/partnerships/company-creation"}]},{"item":"Plateforme Agréée as a Service","icon":"file-invoice","pages":[{"title":"Plateforme Agréée as a Service","href":"/partnerships/plateforme-agreee-as-a-service"}]}],"pages":[{"title":"Partnerships","href":"/partnerships/integrations"}]}]},"basePath":"","title":"The OAuth flow - Qonto","deploymentId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","buildId":"dpl_6UE2cqB47X6P7P3F2hD3UphW6ijc","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-BodsesVp.js","lightbox-handle-r17bVUz3.js"]}