Refresh an OAuth Access Token

By default, access tokens expire after one hour. Once your access token expires, you will need to refresh it. You can use the refresh token that was provided to you with your access token.

What you need:
  • Identity Cloud Service URL: the URL of your Oracle Identity Cloud Service instance. For example: idcs-97b60c2881.identity.myhost.example.com

  • Client ID and Client Secret: the client ID and secret you retrieved when you registered the confidential application in Identity Cloud Service. You can find the client ID and secret in Oracle Identity Cloud Service, in your application. Select the Configuration tab, General Information section of the confidential application you configured in Oracle Identity Cloud Service.

  • Refresh token: Refresh token you received when you requested your access token.

Format:

curl -i  -H 'Authorization: Basic <base64 encoded client ID and secret>' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' --request POST https://<idcs_URL>/oauth2/v1/token -d 'grant_type=refresh_token&refresh_token=<token_value>'

For additional details on refreshing a token, refer to the Oracle Identity Cloud Service REST API https://<idcs_URL>/oauth2/v1/token: Generate Access Token and Other OAuth Runtime Tokens to Access the Resource

Example:

curl -i  -H 'Authorization: Basic QwMS00MjExLThmMGEtxZWQ0NTY1' -H 'Content-Type: application/x-www-form-urlencoded;charset=UTF-8' --request POST https://idcs-a0883735b.identity.myhost.example.com/oauth2/v1/token -d 'grant_type=refresh_token&refresh_token=AQIDBAVRvtv_pz583lpWgI2qHrc0-aOfYrj90pv3Kr-W6av3H3vB7Boxc_DyXpeTl9LRB7djF9NCA='