# JWT token works fine on /users but not /phone/call\_logs

**URL:** <https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405>\
**Category:** Phone\
**Created:** [March 8, 2022, 4:38am UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405 "2022-03-08T04:38:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bradley\_Bristow-Stag](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley_bristow-stag/32/35760_2.png) [@Bradley\_Bristow-Stag](https://devforum.zoom.us/u/Bradley_Bristow-Stag)\
**Post date:** [March 8, 2022, 4:38am UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/1 "2022-03-08T04:38:53Z")

</div>

**Description**  
When calling the endpoint `https://api.zoom.us/v2/phone/call_logs` i get `{ code: 124, message: 'Invalid access token' }`. However, using the same code and pointing to `https://api.zoom.us/v2/users` works.

If I copy the JWT token into PostMan, the call works, so there is nothing wrong with the JWT.  
If I change the URL in my code to `https://api.zoom.us/v2/users` it works, so there is nothing wrong with my code.

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

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
JWT  
using node jsonwebtokens  
same code is used to call other endpoints successfully

**Which Endpoint/s?**  
[https://api.zoom.us/v2/phone/call\_logs](https://api.zoom.us/v2/phone/call_logs)

**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:

```auto
async function getCallLog() {
    try {
        //Use the ApiKey and APISecret from config.js        
        const token = getToken()
        
        let options = {
            url: `https://api.zoom.us/v2/phone/call_logs`,
            method: 'GET',
            headers: {
                Authorization: `Bearer ${token}`,
                'User-Agent': 'Zoom-api-Jwt-Request',
                'content-type': 'application/json'
            }
        };

        let returnData = await axios(options)
        return returnData.data;

    } catch (error) {
        console.log(error.response);
    }
}

function getToken(){
    const payload = {
        iss: process.env.ZOOM_APIKEY,
        exp: ((new Date()).getTime() + 5000)
    };
    const token = jwt.sign(payload, process.env.ZOOM_APISECRET);
    return token;
}

```

**Screenshots (If applicable)**  
Code example

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/3/f/3f2ae2f908d4f05755fca159978f07e8b351d001.png)

PostMan example

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/b/a/ba209f45c4fab278ed5f8a1f635d9da168449bd8.png)

Same code, different endpoint

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/5/a537ea1fb05e8a354148d9b5f7755749c96e5f51.png)

**Additional context**  
If it was a JWT generation issue then the token wouldn’t work in PostMan

If it was a code issue, then it wouldn’t work with other endpoints.

Endpoint in question is not a Master Account and is part of the Zoome Phone SDK: [Zoom Phone API](https://marketplace.zoom.us/docs/api-reference/phone/methods#operation/accountCallLogs)

BIZARRRO!

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [March 10, 2022, 11:58pm UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/2 "2022-03-10T23:58:21Z")

</div>

Hi @Bradley_Bristow-Stag

Thanks for reaching out to the Zoom Developer Forum, I am happy to help here!  
To be able to call the [Get account’s call logs](https://marketplace.zoom.us/docs/api-reference/phone/methods/#tag/Call-Logs) endpoint you will need to meet some Prerequisites:

 ![Screen Shot 2022-03-10 at 6.57.18 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/f/efe1ac30828d2f5f6d1695922064250d07c1ede9.png)

This could be the reason why you are getting an invalid token error.  
Let me know if this helps  
Elisa

---

<div class="post-metadata">

**Author:** ![Bradley\_Bristow-Stag](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley_bristow-stag/32/35760_2.png) [@Bradley\_Bristow-Stag](https://devforum.zoom.us/u/Bradley_Bristow-Stag)\
**Post date:** [March 11, 2022, 12:30am UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/3 "2022-03-11T00:30:31Z")

</div>

Hey @elisa.zoom ,  
Thanks for the reply, but if you check my post you can see that I CAN call that endpoint:

> [@Bradley\_Bristow-Stag](#):
>
> If I copy the JWT token into PostMan, the call works, so there is nothing wrong with the JWT.

Hence my final statement:

> [@Bradley\_Bristow-Stag](#):
>
> **Additional context**  
> If it was a JWT generation issue then the token wouldn’t work in PostMan
> 
> If it was a code issue, then it wouldn’t work with other endpoints.
> 
> Endpoint in question is not a Master Account and is part of the Zoome Phone SDK: [Zoom Phone API](https://marketplace.zoom.us/docs/api-reference/phone/methods#operation/accountCallLogs)

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [March 11, 2022, 12:37am UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/4 "2022-03-11T00:37:22Z")

</div>

@Bradley_Bristow-Stag  
Interesting, allow me some time to dig more into this issue and I will come back to you with an update  
Thanks!  
Elisa

---

<div class="post-metadata">

**Author:** ![Bradley\_Bristow-Stag](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bradley_bristow-stag/32/35760_2.png) [@Bradley\_Bristow-Stag](https://devforum.zoom.us/u/Bradley_Bristow-Stag)\
**Post date:** [March 14, 2022, 9:44pm UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/5 "2022-03-14T21:44:29Z")

</div>

Thanks. Looking forward to hearing back.

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [March 18, 2022, 9:45pm UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/6 "2022-03-18T21:45:53Z")

</div>

Hi @Bradley_Bristow-Stag

Thanks for your patience! I am not able to identify what this issue could be since the token is working with Postman I do not see why it does not work with your code.  
Could you please make a ticket with support so we can investigate this issue further

> **[Zoom Developer Support](https://devsupport.zoom.us/hc/en-us)**

Thanks  
Elisa

---

<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:** [April 18, 2022, 7:45am UTC](https://devforum.zoom.us/t/jwt-token-works-fine-on-users-but-not-phone-call-logs/65405/7 "2022-04-18T07:45:55Z")

</div>

Closed on April 18, 2022, 7:45am UTC

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