Occasional error when refreshing access / zak tokens

Description
We run background jobs to keep our user’s tokens and zak tokens refreshed and valid. Occasionally, our jobs will return {“reason”=>“Invalid request : token created error: Save Access token into Database error”, “error”=>“invalid_request”}. Subsequent retries might work, but we end up with expired tokens sometimes because of this error.

Error
{“reason”=>“Invalid request : token created error: Save Access token into Database error”, “error”=>“invalid_request”}

Which App Type (OAuth / Chatbot / JWT / Webhook)?
Oauth, both account and user levels.

Which Endpoint/s?
/token/

How To Reproduce (If applicable)
Steps to reproduce the behavior:

  1. Attempt to refresh token due to expire in a few minutes
  2. {“reason”=>“Invalid request : token created error: Save Access token into Database error”, “error”=>“invalid_request”}

Screenshots (If applicable)
None

Additional context
None

Hey @naved.khan,

That is strange. Can you please email this error, and your request url, query params, and headers to developersupport@zoom.us so we can take a closer look?

Have you considered refreshing the tokens on user action, for example, once user clicks a create meeting button, check the database to see if the token is expired via the expires_in value, and then if expired, refresh the token, save the new tokens, and then call the API?

Thanks,
Tommy

Hey,

Here is the request we’re making in Ruby code.

        response = HTTParty.post(
            "https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=#{zoom_account.refresh_token}",
            basic_auth: {
                username: client_id,
                password: client_secret
            }
        )

The response to this request is

{“reason”=>“Invalid request : token created error: Save Access token into Database error”, “error”=>“invalid_request”}

This error is not consistent, we see it frequently, but not with every request.

Hey @naved.khan,

Your ruby code looks correct. I am guessing this is happening when you are batch calling the Zoom refresh token API.

Have you considered refreshing the tokens on user action, for example, once user clicks a create meeting button, check the database to see if the token is expired via the expires_in value, and then if expired, refresh the token, save the new tokens, and then call the API?

Thanks,
Tommy

Hi –

I’d like to also chime and say that we’ve seen this error message (Invalid request : token created error: Save Access token into Database error) twice in the last 24 hours when trying to renew a token.

TY.

Thanks for letting us know @sgani!

Our engineering team is looking into this. I will provide updates here. (ZOOM-172624)

-Tommy

Hey Tommy,
I also just noticed this error on our system, what is the link to the ZOOM-172624? Would love to keep an eye on this.

Hey @sgani, @mac, @naved.khan,

Our engineers said that this error is thrown when refreshing with the same refresh token multiple times in a very short time. In this cases only one request (the first one) will return the 200 response with the new access token and refresh token, the other requests will return the error.

Thanks,
Tommy

2 Likes

Ah brilliant, thanks for a quick response. I wanted to check the ticket because my logs pointed at exactly that issue, so thought I could give you a scenario to replicate. Thanks again!

1 Like

Happy to help @mac! :slight_smile:

Thanks,
Tommy