Invalid Access Token from PythonAnywhere

Hello,

I’m working on having PythonAnywhere fetch information from the Zoom Rest API service to import it to our database. I’ve pasted the sample code from the Zoomus python document and was able to test it correctly on my local machine. When I upload the code to PythonAnywhere and run the script, it gives me an error token message. The API Secret and Key are set to not expire on my JWT app, so the expiration of the key and secret should not be an issue.

import requests
import json
from zoomus import ZoomClient

API_KEY='???'
API_SECRET='???'
client = ZoomClient(API_KEY, API_SECRET)
user_list_response = client.user.list()
user_list = json.loads(user_list_response.content)
print(user_list_response, user_list)

As I said, when I run this script on my machine, my console shows a 200 response and prints the JSON results. But when I upload the same sample code and run the script, I get the following error message.

<Response [401]> {'code': 124, 'message': 'Invalid access token.'}

Is there something I’m missing in Zoom? I’ve confirmed with PythonAnywhere that there’s nothing I need to do on their end, I’m wondering if there’s a security reason from Zoom?

I was able to get this solved. There is something wrong with using the handler in PythonAnywhere. I couldn’t figure it out so I had to create the functions to generate the jwt token and request the information to zoom. It’s solved for now, but any further guidance using zoomus would be much appreciated.

@michael12,

Glad to hear you were able to resolve the behavior. Please post the solution for other community members, it will be a great benefit.

Thanks for being a part of the Zoom Developer Forum Community— we are thrilled you’re here!