v1

latestOpenAPI 3.1.02026-07-2483219318.4 KB
Auth

Exchange an Authorization Code

This endpoint is the final step in our 📖 OAuth Authentication Flow.

Use this endpoint to exchange an Authorization Code for a User Access Token, which can be used to access the rest of this API.

To ensure that your application does not retain unnecessary access to user data, revoke this access token in the event that is no longer required (e.g. the user deletes their account).

Endpoint not applicable for Personal Apps. See our 📚 Getting started guide to set up your Personal App.

📘

OAuth2 Error Responses

In keeping with the OAuth2 specification, error responses from this endpoint contain an error in the error field, rather than the message field used by other Akahu endpoints.

For more details see:

  • 📚 OAuth Authentication Flow.
  • 📖 Auth scopes
  • 📖 Token webhooks
  • 📚 Accessing transactional data guide
  • 📚 Accessing account data guide
post/token

Request body

grant_typestring required

Must always be authorization_code

codestring required

The code to be exchanged for a User Access Token, received upon the user's completion of the authorization redirect flow.

redirect_uristring required

Same redirect_uri you specified to start the OAuth flow to receive an exchange code.

client_idstring required

Your Akahu App ID Token

client_secretstring required

Your Akahu App Secret

Example request

{
  "grant_type": "authorization_code",
  "code": "code",
  "redirect_uri": "http://localhost:3000/redirect",
  "client_id": "{{app_auth}}",
  "client_secret": "{{appSecret}}"
}

Response

Successful response.

successboolean
access_tokenstring

Authorised User Access Token used to authenticate the user upon additional resource request.

token_typestring

Type of authentication

scopestring

whitespace separated string specifying the granted permissions and resources the given token has access to.

Example response

{
  "success": true,
  "access_token": "user_token_1111111111111111111111111",
  "token_type": "bearer",
  "scope": "IDENTITY_BASIC ACCOUNTS TRANSACTIONS"
}
All 83 operations