Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!

refresh_token for AEP API

Avatar

Level 2

I have used postman to get Oath tokens, that expired after every 24hr. if we need to use refresh token to get new Oath token, how do we do that ?

 

https: // {{IMS}}/ims/token/v2 ? grant_type=client_credentials&client_id={{API_KEY}}&client_secret={{CLIENT_SECRET}}&scope={{SCOPES}}

 

I have tried including offline_access in the scope variable, but still it doesnt return any refresh token

3 Replies

Avatar

Community Advisor

Hi @Pradeep-Jaiswal 

That is the same POST call I would make to retrieve a new token. Do you have your post script set as this below?

var data = JSON.parse(responseBody);

if (data.access_token) {
    pm.environment.set("ACCESS_TOKEN", data.access_token);
} else {
    console.log("Unable to acquire ACCESS_TOKEN from Adobe IMS to make further calls to Adobe I/O APIs.")
}

Avatar

Level 2

I do the same thing when using postman, but refresh_token is not part of the response. it only has access_token and expiry. this page talks about refresh_token https://developer.adobe.com/developer-console/docs/guides/authentication/UserAuthentication/IMS/#fet...

Avatar

Community Advisor

Sorry @Pradeep-Jaiswal I’m not very familiar with this then I’m afraid. I do see here that the refresh token will not always be provided.

 

Once you have fetched the access tokens for a user you may also be provided a refresh token in the response. A refresh token is only presented when the offline_access scope is requested in the authorize step. Please note that not all APIs and Services support the offline_access scope for security reasons.