# Ruby on rails - JWT API access

**URL:** <https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584>\
**Category:** API and Webhooks\
**Created:** [June 10, 2019, 9:57pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584 "2019-06-10T21:57:10Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![storypark](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/storypark/32/1052_2.png) [@storypark](https://devforum.zoom.us/u/storypark)\
**Post date:** [June 10, 2019, 9:57pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/1 "2019-06-10T21:57:10Z")

</div>

Hi there,

Hoping someone can help.

We have set up our code like:

 ![49%20AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/0/0fc152c1a9e6a3e9005c425c3ec774bf1ab90109.png)

and when we run this in the rails console we get:

```auto
response.read_body
{"code":124,"message":"Invalid access token."}

```

When I generate the token from the “Send test request” here: [https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinars](https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinars)

and copy paste that token into this part:

```auto
request["authorization"] = "Bearer TOKEN"

```

it works and we get the response we are after. So the problem lies somewhere in the way our Ruby code is generating the token…

Does anyone know how to resolve this or do you need anymore information?

Hope you can help,  
Tim

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [June 10, 2019, 11:03pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/2 "2019-06-10T23:03:40Z")

</div>

@storypark,

Welcome to the Zoom Developer Support Forum.

Can you please check if you are using the correct credentials for your account within your code? The error `{"code":124,"message":"Invalid access token."}`, is generally seen when you do not have the correct access token for the account.

For more information, please visit: [JWT quickstart.](https://marketplace.zoom.us/docs/guides/authorization/jwt/quickstart)

Thanks,  
Ojus

---

<div class="post-metadata">

**Author:** ![storypark](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/storypark/32/1052_2.png) [@storypark](https://devforum.zoom.us/u/storypark)\
**Post date:** [June 10, 2019, 11:12pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/3 "2019-06-10T23:12:33Z")

</div>

> [@ojus.zoom](#):
>
> ` access token."}` , is generally seen when you do not have the correct access token for the account.

Hi Ojus thanks for the fast response.

I have added the ClientID as the API\_KEY and the Client Secret as the API\_SECRET and got those both from here:

 ![15%20AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/6/654b9a6f903a7405891331b086d64941f3c84f77.png)

So as far as I can see, they are the correct credentials…

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [June 11, 2019, 9:23pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/4 "2019-06-11T21:23:45Z")

</div>

Hi @storypark,

Quick question:

Can you please confirm whether the account that you are trying to generate from has developer permissions ?

An admin on your account either needs to grant those permissions or move you to a role that already has them.

Let me know if you have any questions

Thanks!

---

<div class="post-metadata">

**Author:** ![storypark](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/storypark/32/1052_2.png) [@storypark](https://devforum.zoom.us/u/storypark)\
**Post date:** [June 11, 2019, 9:40pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/5 "2019-06-11T21:40:02Z")

</div>

Thanks Ojus,

I have sent a message to our admin account holder so hopefully she can help.

However, using the test API at the bottom of the screen here: docs/api-reference/zoom-api/webinars/webinars

It has a step where it asks you to log in then it generates the token. The account we log in with is admin…storypark.com, the main account holder is sharon…storypark.com. When we use the test account we log in with admin…storypark.com and the token it gives us works.

Using JWT in our code, there’s no step to log in or provide user details except for the userId we put into the URL…

---

<div class="post-metadata">

**Author:** ![storypark](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/storypark/32/1052_2.png) [@storypark](https://devforum.zoom.us/u/storypark)\
**Post date:** [June 11, 2019, 10:27pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/6 "2019-06-11T22:27:45Z")

</div>

Perhaps the problem is that we’ve set up the app in the marketplace under admin@story… and the userID from the URL we’re trying to ping at: url = URI(“[https://api.zoom.us/v2/users/#{USER\_ID}/webinars](https://api.zoom.us/v2/users/#%7BUSER_ID%7D/webinars)”) is the owner account which is Sharon’s email…

Do you think the owner account should be the account which creates the app in the marketplace? i.e. admin@… should be the owner and then the USER\_ID would be from that.

---

<div class="post-metadata">

**Author:** ![storypark](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/storypark/32/1052_2.png) [@storypark](https://devforum.zoom.us/u/storypark)\
**Post date:** [June 11, 2019, 10:39pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/7 "2019-06-11T22:39:17Z")

</div>

Thanks for all your help Ojus,

I have now set up an app under Sharon’s account and it’s all working, so that was the problem here.

Seems like it’s all go now! Thanks again.

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [June 12, 2019, 12:22am UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/8 "2019-06-12T00:22:44Z")

</div>

Hi,

Glad that the issue was resolved

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 6:28pm UTC](https://devforum.zoom.us/t/ruby-on-rails-jwt-api-access/4584/9 "2020-08-21T18:28:58Z")

</div>


