Generate the Refresh Token
Refresh tokens are used to generate access tokens for invoking APIs.
To generate a Access token using Refresh token, use the following
Curl command. You can use an insecure connection (if you add the
--insecure
/ -k
flag to the cURL command). The
following is an example:
curl -k -i -H "Authorization: Basic <base64Encoded clientid:secret>" -H "Content-Type:
application/x-www-form-urlencoded;charset=UTF-8" --request POST
https://<IdentityDomainURL>/oauth2/v1/token -d
"scope=urn:opc:idm:__myscopes__&grant_type=refresh_token&refresh_token=<refresh_token>"
Sample Code
curl -k -i -H "Authorization: Basic
cWppMHBkLXByZF9BUFBJRDplZjFjMTVmZi1lZDBiLTQxNmItYTFmYy0wNjhlYzM5NmUxM2Y=" -H
"Content-Type: application/x-www-form-urlencoded;charset=UTF-8" --request POST
https://<IdentityDomainURL>/oauth2/v1/token -d
"scope=urn:opc:idm:__myscopes__&grant_type=refresh_token&refresh_token=AgAgYjA1OGVlMjJiMWY2NGU3YWFkM2NjZWNlOTc2MjNiNDgIABBmZRHXpaHil2VBXkevFX-iAAAAMMq9uQDo86eVVVisw3kYn80iX8qRJ2m7hMLmMAh1dY9Wgy-ESu8WYzdTBXOsnwHr7A=="
Sample Refresh Token (Truncated example)
{"access_token":"eyJ4NXQjUzI1NiI6IlF5azRtb3pIakhuQjJoQnVWdmZXZUpVeVZrNHhUdWd6aWpHSC1pV21xb1EiLCJ4NXQiOiJDRFhHYVlWZXI3STVhQ1l...
...
...
token_type":"Bearer","expires_in":3600,"refresh_token":"AgAgYjA1OGVlMjJiMWY2NGU3YWFkM2NjZWNlOTc2MjNiNDgIABA4t8V_dYVyc5lOuKezofTUAAAAMJrpmKRhDWf3-ejCreU8_Po5Bb95srwUDDs5cV1gT-x26twbAfp_ffMCiEgjqGeDNw=="}