# Invalid Access Token Error

**URL:** <https://devforum.zoom.us/t/invalid-access-token-error/856>\
**Category:** API and Webhooks\
**Created:** [January 5, 2018, 8:56am UTC](https://devforum.zoom.us/t/invalid-access-token-error/856 "2018-01-05T08:56:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jigsaw\_Academy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jigsaw_academy/32/33878_2.png) [@Jigsaw\_Academy](https://devforum.zoom.us/u/Jigsaw_Academy)\
**Post date:** [January 5, 2018, 8:56am UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/1 "2018-01-05T08:56:42Z")

</div>

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

&nbsp;

Below is the sample API call that I am testing

**curl [https://api.zoom.us/v2/accounts?access\_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1MDg1ODg2MDI3fQ.CKB4gXZrQxsDbXf98ex3DHpcCZXt8gyHOq6P99\_C9g0](https://api.zoom.us/v2/accounts?access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1MDg1ODg2MDI3fQ.CKB4gXZrQxsDbXf98ex3DHpcCZXt8gyHOq6P99_C9g0)**

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

**&nbsp;**

Below is the code to generate the access token

&nbsp;

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**

---

<div class="post-metadata">

**Author:** ![Joshua\_Woodward1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/joshua_woodward1/32/1480_2.png) [@Joshua\_Woodward1](https://devforum.zoom.us/u/Joshua_Woodward1)\
**Post date:** [January 8, 2018, 6:18pm UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/2 "2018-01-08T18:18:30Z")

</div>

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

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

&nbsp;

Is that you api key?

---

<div class="post-metadata">

**Author:** ![Jigsaw\_Academy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jigsaw_academy/32/33878_2.png) [@Jigsaw\_Academy](https://devforum.zoom.us/u/Jigsaw_Academy)\
**Post date:** [January 9, 2018, 5:22am UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/3 "2018-01-09T05:22:27Z")

</div>

Hi Joshua,

Thanks for your reply.

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

I verified&nbsp;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.

---

<div class="post-metadata">

**Author:** ![Wei\_Guo1](https://avatars.discourse-cdn.com/v4/letter/w/ec9cab/32.png) [@Wei\_Guo1](https://devforum.zoom.us/u/Wei_Guo1)\
**Post date:** [January 10, 2018, 1:11am UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/4 "2018-01-10T01:11:51Z")

</div>

Hi Jigsaw Academy,

the timestamp value is valid.&nbsp;

Please check the following sample as reference.&nbsp;

 ![](https://support.zoom.us/hc/user_images/IL8_6dBkCIHziB6nDoCnZw.jpeg)

Best

---

<div class="post-metadata">

**Author:** ![Jigsaw\_Academy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jigsaw_academy/32/33878_2.png) [@Jigsaw\_Academy](https://devforum.zoom.us/u/Jigsaw_Academy)\
**Post date:** [January 10, 2018, 4:53pm UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/5 "2018-01-10T16:53:58Z")

</div>

Hello,

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

---

<div class="post-metadata">

**Author:** ![Joshua\_Woodward1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/joshua_woodward1/32/1480_2.png) [@Joshua\_Woodward1](https://devforum.zoom.us/u/Joshua_Woodward1)\
**Post date:** [January 10, 2018, 5:36pm UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/6 "2018-01-10T17:36:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jigsaw\_Academy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jigsaw_academy/32/33878_2.png) [@Jigsaw\_Academy](https://devforum.zoom.us/u/Jigsaw_Academy)\
**Post date:** [January 11, 2018, 3:34pm UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/7 "2018-01-11T15:34:45Z")

</div>

Am using CURL command to test the API

curl -v [https://api.zoom.us/v2/accounts?access\_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJIRFVpanExLVRIYTlwM09YSmwyR1R3IiwiZXhwIjoxNTE1Njg4MzU4NzM5fQ.AVLNW3EVr3\_PhxwA3RZdTnA3u9ZToONd7qS\_0BNSNZA](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](https://api.zoom.us/v2/accounts)

---

<div class="post-metadata">

**Author:** ![Joshua\_Woodward1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/joshua_woodward1/32/1480_2.png) [@Joshua\_Woodward1](https://devforum.zoom.us/u/Joshua_Woodward1)\
**Post date:** [January 11, 2018, 6:09pm UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/8 "2018-01-11T18:09:58Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Jigsaw\_Academy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jigsaw_academy/32/33878_2.png) [@Jigsaw\_Academy](https://devforum.zoom.us/u/Jigsaw_Academy)\
**Post date:** [January 12, 2018, 5:27am UTC](https://devforum.zoom.us/t/invalid-access-token-error/856/9 "2018-01-12T05:27:44Z")

</div>

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.
