JWT token works fine on /users but not /phone/call_logs

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

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

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

PostMan example

Same code, different endpoint

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

BIZARRRO!

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 endpoint you will need to meet some Prerequisites:

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

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

Hence my final statement:

@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

1 Like

Thanks. Looking forward to hearing back.

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

Thanks
Elisa

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