Code: 124, message: 'Invalid access token.' Error

Scoured through the devforum but couldn’t solve my issue.


Meeting SDK Type and Version
Web Meeting SDK, JWT App, Account-level app.

Description
I’m developing a simple app to create a meeting using the zoom api
const url = “https://api.zoom.us/v2/users/{userid}/meetings”. I have passed in the body and header as follows:

const data = {
“agenda”: “My Meeting”,
“default_password”: false,
“duration”: 60,
“password”: “123456”,
“pre_schedule”: false
}

        const params = {
            uri: url,
            method: 'POST',
            mode: 'cors',
            header: {
                'Content-Type': 'application/json',
                'authorization': 'Bearer xxx'
            },
            body: JSON.stringify(data)
        }

        fetch(url, params)
            .then(res => res.json())
            .then(result => console.log(result))
            .catch(err => console.log(err))
    })

This api works in Postman well with the above body and header, but returns 124, invalid access token in my browser. I have disabled cors check on my browser since this is only a internal app. I have also tried using the me/meetings path, but doesn’t work.

Error?
{code: 124, message: ‘Invalid access token.’}

code: 124
message: “Invalid access token.”
[[Prototype]]: Object

constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
 propertyIsEnumerable: ƒ propertyIsEnumerable()
 toLocaleString: ƒ toLocaleString()
 toString: ƒ toString()
 valueOf: ƒ valueOf()
 __defineGetter__: ƒ __defineGetter__()
 __defineSetter__: ƒ __defineSetter__()
 __lookupGetter__: ƒ __lookupGetter__()
 __lookupSetter__: ƒ __lookupSetter__()
 __proto__: (...)
 get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()

Troubleshooting Routes
Tried everything from sample app to all suggestions by others on the forum, but nothing works.

How To Reproduce
Steps to reproduce the behavior including:
Authentication method: JWT token, App type: JWT app

Thanks.

which API you using (incl version)?

you use the deprecated JWT app?

where is the sample app from, which version?

all zoom examples that I know from March 2022 and newer are using the SDK JWT (not compatible with the JWT app)

Jürgen

Welcome, @manalg ,

Thank you for posting! That behavior sounds strange. You mentioned that the API works in Postman, have you tried to manually add the working Bearer access token when making the fetch API request?

api: https://api.zoom.us/v2/users/{userid}/meetings

JWT app has not been deprecated, it will be deprecated in June 2023, as per its documents. I think I forgot to mention it, I am just developing a simple demo of zoom client, so I am not that worried about the deprecation next year right now.

I got the sample app from the github of zoom - GitHub - zoom/meetingsdk-web-sample: Zoom Meeting SDK Web Sample App

Yes, I tried that as well, it didn’t work.
But in the end, I took the code snippet from postman and edited it in my app as suited to my needs, and it worked. Probably the issue was that I was adding mode: ‘cors’ in my header, because that is the only difference from my code to the postman’s code snippet.
Anyway, thank you for the time!
Manal.

@manalg,

Glad to hear you were able to get it working. I suspect the cors headers were the culprit as well. Should you have any additional questions, please let us know.

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