Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

how to generate a new token using refresh token

Hi Team,

I have generated a new access token and refresh token for the machine user.

https://docs.apigee.com/api-platform/system-administration/automating-tasks

I got a new access and refresh token using the following command.

curl -H "Content-Type: application/x-www-form-urlencoded;charset=utf-8" \
  -H "accept: application/json;charset=utf-8" \
  -H "Authorization: Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0" -X POST \
  https://zoneName.login.apigee.com/oauth/token -s \
  -d 'grant_type=password&username=machineusername&password=machineuserpassword'

Access token is expired now. Now i have generated a new token using refresh token.

curl -H "Content-Type:application/x-www-form-urlencoded;charset=utf-8" \
  -H "Accept: application/json;charset=utf-8" \
  -H "Authorization: Basic ZWRnZWNsaTplZGdlY2xpc2VjcmV0" -X POST \
  https://zoneName.login.apigee.com/oauth/token \
  -d 'grant_type=refresh_token&refresh_token=REFRESH_TOKEN'

I got a new access and refresh token. Which token i should use? I used the refresh token but it got expired today. Please find the below Jenkins console output error

Access token not valid so acquiring new access token using Refresh Token

Please let me know which token i should use for longer validation?

Also i came across this page but they have not updated the exact steps how they fixed it?

I have last expired access and refresh token with me. Please let me know some steps to fix it.

https://community.apigee.com/questions/51963/how-to-get-last-associated-access-token-with-refre.html

0 22 3,336
22 REPLIES 22