Invalid Access Token Error

I am trying to use zoom API’s and facing an issue with the same

 

Below is the sample API call that I am testing

curl https://api.zoom.us/v2/accounts?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1MDg1ODg2MDI3fQ.CKB4gXZrQxsDbXf98ex3DHpcCZXt8gyHOq6P99_C9g0

But am getting the response as {“code”:124,“message”:“Invalid access token.”}

 

Below is the code to generate the access token

 

I have generated API key and API secret from the account.

**require ‘jwt’

payload = { iss: key, exp: ((Time.now + 1.hour).to_f * 1000).to_i }
header = { alg: “HS256”, typ: “JWT” }

token = JWT.encode payload, secret, ‘HS256’, header**

NOTE: I am using Ruby as the programming language

please verify that you are using the correct api key and secret. The above jwt decodes the payload to

{
“iss”: “HDUijq1-THa9p3OXJl2GTw”,
“exp”: 1515085886027
}

 

Is that you api key?

Hi Joshua,

Thanks for your reply.

Yes, this is our API key “HDUijq1-THa9p3OXJl2GTw”

I verified again, am using the correct API credentials.

And can you also please let me know if the timestamp value that am sending as the expiry is in valid format.

Hi Jigsaw Academy,

the timestamp value is valid. 

Please check the following sample as reference. 

Best

Hello,

That’s exactly what am doing, but still getting the same error. Not sure why.

Can you share your actual REST call code, maybe an issue on how you’re passing the token

Am using CURL command to test the API

curl -v https://api.zoom.us/v2/accounts?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1Njg4MzU4NzM5fQ.AVLNW3EVr3_PhxwA3RZdTnA3u9ZToONd7qS_0BNSNZA

another example:

curl -H “Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1Njg4MzU4NzM5fQ.AVLNW3EVr3_PhxwA3RZdTnA3u9ZToONd7qS_0BNSNZA” -H “Content-Type: application/json” https://api.zoom.us/v2/accounts

This may be a false error message. You may not have access to the accounts API, and there is a bug to change the error message. Can you try the users endpoint and see if the issue remains?

Hello Joshua,

I tried the users API, it is working.

I had put the same example in the first post itself. If this was communicated to me then it would have been very helpful as we took 1 week of time to resolve this. And please change the error message as it is very confusing, even though the access token is correct it is saying invalid.