Access Token
To obtain an access token, send a POST request to the OAuth endpoint. Upon successful authentication, the server will respond with an access token that can be used for subsequent API requests.
Attributes
| Parameter | Type | Description |
|---|---|---|
token_type | string | The type of token, typically "Bearer". |
expires_in | integer | The lifetime of the access token in seconds. |
access_token | string | The access token string as issued by the authorization server. |
refresh_token | string | The token that can be used to obtain a new access token when the original expires. |
Request
Endpoint: POST /oauth/token
bash
$ curl --location --request POST 'https://api.youcanpay.com/oauth/token' \
--form 'client_id="9b2efcdf-4493..."' \
--form 'client_secret="AGZaZrlI28D..."' \
--form 'grant_type="authorization_code"' \
--form 'redirect_uri="https://test.com"' \
--form 'code="f50200273ca0350c000062e5820..."' \
--header 'Accept: application/json'Response
The response object
json
{
"token_type": "Bearer",
"expires_in": 31622400,
"access_token": "eyJ0eXAiOiJKV1QiL...",
"refresh_token": "def50200fb4a514810b8d8fc32..."
}