OAuth 2.0 Token Refresh with Python

Does anyone have example of Python code for refreshing OAuth 2.0 Token? I have built out my app fully and everything is working great, just can’t figure out how to refresh the token, as of now I’m just manually refreshing every 1 hour.

Thank you for posting in the Zoom Developer Forum – happy to help here @nbecirovic ! Before getting started, can you share how you are implementing OAuth in your application? Generally, you would want to store your refresh token for use when you want to make a request to get another token. You can either use a cache like Redis or db to handle storing and refreshing tokens

I’m followed your guys guide for Postman for OAuth 2.0 and from there I just manually refresh the token and copy it to my Python application.


Are you able to share the snippet of code that handles making getting the Access token in your Python Application?

I’m not getting the the token through my python code. I’ve created App in Zoom Marketplace, set up ClientID, Client Secret and Scopes. From there I used postman to create connection to Zoom API and via Postman I get the actual token to make the API calls.

I use that token in my Python code as such:

myToken = 'Bearer *token*'
myUrl = 'https://api.zoom.us/v2/users'
head = {'Authorization': myToken}

This works but its obviously not long term solution since I have to manually refresh that token in Postman and then copy it back to my Python code.

Okay, I see. The first thing I’d recommend is that the OAuth flow is handled in your application. That way you can implement the logic for:

  1. Retrieving the access token

  2. Storing/caching it for the duration of its lifetime (60 mins)

  3. Refreshing the token

Here is a post with instructions on handling OAuth flow with a Python application. Take a look and let us know if you have any questions:

In the above code would I use the same REDIRECT_URI? In my current App I use:


Also what do those functions do since I don’t see them being called or using the client variables?