To exchange an authorization code for an access token, send a "fetch access token" API
request containing the following parameters:
POST /oauth2/token HTTP/1.1
grant_type=authorization_code&
code=authorization-code&
client_id=your-client-id&
client_secret=your-client-secret&
redirect_uri=application-redirect-uri
This will return an accessToken resource, including a refresh_token that can be used
offline to aquire a new access_token, once the access_token has expired.
When an access token has expired, you can generate a new token without any user involvement
by sending the refresh token in a request to the "fetch access token" API:
POST /oauth2/token HTTP/1.1
grant_type=refresh_token&
refresh_token=a_refresh_token&
client_id=your-client-id&
client_secret=your-client-secret
The accessToken resource returned from a refresh request will not contain a refresh_token.