Error in Refreshing with refresh tokens

I’m Integrating Zoom service with our service projects. Please have a look on below scenario

Scenario 1: While Integrating Zoom account A with user A on project A,B I’m getting same access token and refresh tokens no problems arise.

Scenario 2: While Integrating Zoom account A with user A on project A and after 1hour integrating same Zoom account A with project B I’m getting different access token and refresh tokens (differ with project A ).
After Integration I’m creating zoom meeting with project A after 1hour (token expired for project A). I’m getting response as invalid access token while hitting API call for updating new access and refresh token . I followed up with your documentation stats"Refresh Tokens have a lifespan of 15 years. When you refresh an access token, you will also get a new refresh token that you need to use in your next refresh. Store the new refresh token safely for the next time when you try to refresh the tokens." since i had not used up this refresh token before why i’m getting invalid refresh token(lifespan 15yrs).

Hey @ezhilvelan006 thanks for reaching out!

I believe the issue is you generated a new access_token which then made your previous refresh_token invalid.

Each time you refresh your access_token in the response you also get a new refresh_token that you need to use the next time you refresh your access_token.

Also make sure your refresh token request is accurate

POST REQUEST URL https://zoom.us/oauth/token?grant_type= refresh_token&refresh_token={{ REFRESH TOKEN HERE }}

POST REQUEST BODY:

{
"Authorization" : "Basic base64Encode({{client_id here}}:{{client_secret here}})"
}

Does that help explain things?

Thanks,
Tommy

No Tommy.

I had not generated new access_token. At very first time, I’m integrating Zoom account A and stored all the details from response. I’m just integrated the same Zoom account A again after 1 hour in that i found different different access and refresh tokens. Is 1st integration details will not be valid after 2nd integration with same Zoom account ???. Using 1st integration details i’m trying to create a Zoom meeting link. But i found access token expired so i’m refreshing 1st integration details with refresh token (token received on 1st integration). In this scenario i’m getting response as invalid refresh token. My question is why refresh token is to be invalid since i had not used anywhere this refresh token, i’m integrated the same zoom account again that all. How it will affect the 1st integration details. I followed up with your documentation - i found refresh token is valid for 15yrs until refreshing for new access token then how it been receiving response as invalid refresh token.
Regards,
Ezhilvelan

Hey @ezhilvelan006,

I’m confused, what do you mean by “Integrating” (when you see the access and refresh tokens change)?

Are you reinstalling the app or something else?

Thanks,
Tommy

Hey Tommy,
Integration means Authentication using oAuth.

Authenticating again using same Zoom account. No reinstalling the app.

Thanks,
Ezhilvelan

Thanks @ezhilvelan006,

Can you double check you are following the correct flow?

Here is the flow from start to finish on a per install basis,

  1. Go to url below (or click install app button on app dashboard) to authorize your app,

GET https://zoom.us/oauth/authorize?response_type=code&client_id={YOUR_CLIENT_ID}&redirect_uri={YOUR_REDIRECT_URI}

Grab the authorization code in the redirect url https://yourRedriectUrl.com?code={AUTHORIZATION_CODE}

  1. Then request an access token

POST https://zoom.us/oauth/token?grant_type=code&redirect_uri={YOUR_REDIRECT_URI}&code={AUTHORIZATION_CODE}

HEADERS: {"Authorization": "Basic {BASE64ENCODED_CLIENT_ID}:{BASE64ENCODED_CLIENT_SECRET}"}

This will give you an access_token and refresh_token

The access_token is different per user and lasts for one hour.
The refresh_token is different per user and lasts for 15 years (unless you refresh access_token in which it becomes invalid and you get a new one)

You want to store both of these.

Now let’s say your access_token is no longer valid

  1. You need to refresh the access_token,

POST https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token={REFRESH_TOKEN}

HEADERS: {"Authorization": "Basic {BASE64ENCODED_CLIENT_ID}:{BASE64ENCODED_CLIENT_SECRET}"}

Now this will return a new access_token AND a new refresh_token. You need to store these new values as the old ones are now invalid.

You can use the access_token to call Zoom API’s, and when the access_token is expired, repeat step 3 for that user to get a new access_token and refresh_token.

Let me know if this helps, otherwise I will look into your account specifically.

Thanks,
Tommy

@tommy I’m not sure if this related but we’re seeing inconsistent refresh results. We are refreshing tokens in a batch and 99% of the time it works fine, but occasionally it will fail on a portion of the refresh requests with the Invalid refresh Token error message. Is this a known issue and what can we do about it so that our users are not constantly having to reauthorize our app?

Hey @Ryan_Chapman,

Possible duplicate / relation to:

https://devforum.zoom.us/t/how-to-refresh-token-if-refresh-token-in-incorrect

Can you PM me with your app id (path in url when on app marketplace dashboard) and account email and we will take a look?

Thanks,
Tommy