How to generate access token using refresh token in c#

(Ashwini S) #1


Need help to generate access token using refresh token for long live without authorization window in c#.

I used API “” to generate token its working fine for 10 or 15 min and then getting an error asking for new refresh token(invalid refresh token)

Ashwini S

(Stephen Ausman) #2

Hey Ashwini,

When you get a token the response should include refresh_token and expires_in values. The expires_in value is the number of seconds until your token expires. The refresh_token value can be exchanged for a new token when your token expires. Exchanging a refresh_token for a new token is similar to exchanging a code for a token.

Here’s what it looks like in cURL:

$ CLIENT_ID=your_client_id CLIENT_SECRET=your_client_secret REFRESH_TOKEN=your_refresh_token
$ curl -d "grant_type=refresh_token&refresh_token=$REFRESH_TOKEN&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET"

Hopefully that helps. Let us know if you have any other questions.

(Ashwini S) #3

Thanks Stephen…

   My issue was i didn't replaced existing refresh-token after refreshing the token. now its working fine.