GuideCustom appsAPIPOST /oauth2/v1/access_token

The POST /oauth2/v1/access_token endpoint performs the final setup and validation of OAuth version 2 accounts. Information as received from the third party upon redirection to the previously posted callback_uri are sent to this endpoint, with other applicable account information, for final setup. The account is then validated and, if successful, the account is returned; if there is an error, it is to be raised appropriately.

The information that is sent to endpoint includes:

  • fields.callback_uri - callback uri that is used for user redirection
  • code - the authorization code received from the authorization server during redirect on callback_uri

Request body sample:

{
    "fields": {
        "callback_uri": "https://oauth.vizydrop.com"
    },
    "code": "xxxxx"
}

Response can include any data that will be used to authenticate account and fetch information.

Tip: You can include parameters with refresh_token and expires_on and then on validate step proceed with access token refresh if it is expired or about to expire.

Response body sample:

{
    "access_token": "xxxxxx",
    "refresh_token": "xxxxxx",
    "expires_on": "2020-01-01T09:53:41.000Z"
}