# 124 Error when running code on Server. Works fine on my Laptop

**URL:** <https://devforum.zoom.us/t/124-error-when-running-code-on-server-works-fine-on-my-laptop/55864>\
**Category:** API and Webhooks\
**Created:** [August 16, 2021, 2:12pm UTC](https://devforum.zoom.us/t/124-error-when-running-code-on-server-works-fine-on-my-laptop/55864 "2021-08-16T14:12:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fff](https://avatars.discourse-cdn.com/v4/letter/f/9de053/32.png) [@fff](https://devforum.zoom.us/u/fff)\
**Post date:** [August 16, 2021, 2:12pm UTC](https://devforum.zoom.us/t/124-error-when-running-code-on-server-works-fine-on-my-laptop/55864/1 "2021-08-16T14:12:02Z")

</div>

**Description**  
I wrote python code to get all currently scheduled Meetings. When I tested it on my Laptop it worked fine and I got the list of scheduled Meetings. But after hosting my code on a server I zoom returns `{'code': 124, 'message': 'Invalid access token.'}`

**Error**  
`{'code': 124, 'message': 'Invalid access token.'}`

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
JWT

**Which Endpoint/s?**

```auto
https://api.zoom.us/v2/users/{userId}/meetings?type=upcoming

```

**How To Reproduce (If applicable)**  
My python Code:

```auto
import jwt, requests, json
from time import time

API_Key = 'XXXXXXXXXXXXXXXXXX'
API_SEC = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX'

def generateToken():
    token = jwt.encode(
        
        # Create a payload of the token containing 
        # API Key & expiration time
        {'iss': API_Key, 'exp': (time() + 5000)},
          
        # Secret used to generate token signature
        API_SEC,
          
        # Specify the hashing algorithm
        algorithm='HS256'
    )
    return token

def getMeetings():
    headers = {'authorization': 'Bearer %s' % generateToken(),
               'content-type': 'application/json'}
    r = requests.get(
         f'https://api.zoom.us/v2/users/{userId}/meetings?type=upcoming', 
       headers=headers)
    y = json.loads(r.text)
    return y

```

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [August 18, 2021, 2:52am UTC](https://devforum.zoom.us/t/124-error-when-running-code-on-server-works-fine-on-my-laptop/55864/2 "2021-08-18T02:52:03Z")

</div>

Hey @fff,

Thank you for reaching out to the Zoom Developer Forum. Please send an email to [developersupport@zoom.us](mailto:developersupport@zoom.us) with a link to this thread. In that email, please provide an example of a token that your server generated.

I’ll investigate further from there.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [September 17, 2021, 12:52pm UTC](https://devforum.zoom.us/t/124-error-when-running-code-on-server-works-fine-on-my-laptop/55864/3 "2021-09-17T12:52:49Z")

</div>

Closed on September 17, 2021, 12:52pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
