This feature is only available in the Enterprise version

Access control

Create OAuth token

Exchange an authorization code for an access token, or refresh one.

POST/oauth/token

Create OAuth token exchanges an authorization code for an access token, or refreshes an access token. Start sign-in with Authorize OAuth.

Send this request to https://api.cloud.blnkfinance.com on Blnk Cloud. On a self-hosted Enterprise deployment, send it to ENTERPRISE_PUBLIC_URL.

Send the client id and client secret as HTTP Basic, or in the body as client_id and client_secret. The body is form fields or JSON.

The access token lasts 1 hour. Send it as X-blnk-key on Enterprise API requests.

A refresh returns a new access token and a new refresh token, and the previous refresh token stops working. The refresh token lasts 30 days.

Authorizationstringheader

HTTP Basic credentials, Basic base64(client_id:client_secret). Omit this when client_id and client_secret are in the body.

Body

grant_typestringrequiredbody

authorization_code or refresh_token.

codestringbody

Authorization code from Authorize OAuth. Required when grant_type is authorization_code. The code lasts 10 minutes and works once.

redirect_uristringbody

The same redirect_uri used to authorize. Required when grant_type is authorization_code.

refresh_tokenstringbody

Refresh token from an earlier response (blnk_rt_...). Required when grant_type is refresh_token.

client_idstringbody

Client id. Required when you do not send the Authorization header.

client_secretstringbody

Client secret. Required when you do not send the Authorization header.

code_verifierstringbody

PKCE verifier. Required when the authorization request included code_challenge.

Response

A 200 response returns the tokens. Save access_token and refresh_token. Invalid client credentials return 401 with invalid_client.

access_tokenstringrequired

Access token (blnk_at_...). Send it as X-blnk-key.

token_typestringrequired

Bearer.

expires_inintegerrequired

Seconds until the access token expires. 3600.

refresh_tokenstringrequired

Refresh token (blnk_rt_...). Each refresh replaces this value.

scopestring

Space-separated scopes on the token.