Help with Zoom OAuth REST API on NodeJS

Hi Team,

I’m developing a product in which I need to take in a users zoom account and generate an access token.
I’m getting the authorization code but for the next step where I request access token, I’m getting an response error as ‘Invalid Client ID or Secret’. But when checked, both the ID and secret are the same as in my App Marketplace. Using Developer account for testing and it’s an Admin Level App.
Endpoint/s
https://zoom.us/oauth/token

Code:

    if(authorization_code){
        var auth = "Basic "+ new Buffer(CLIENT_ID+":"+CLIENT_SECRET).toString('base64')
        var header = {"Authorization":auth}
        var url = `https://zoom.us/oauth/token?grant_type=authorization_code&code=${authorization_code}&redirect_uri=http://localhost:4000/callback`
        axios.post(url,header).then(result => {
            console.log(result.response)
        }).catch(e => {
            console.log(e)
        })
    }

Error:
data: {
reason: ‘Invalid client_id or client_secret’,
error: ‘invalid_client’
}

Please let me know what mistake I’m making in the process

Hey @vsushant97, thanks for posting and using Zoom!

Can you try using the Buffer.from(CLIENT_ID+":"+ CLIENT_SECRET).toString('base64') syntax?

Or try passing in an empty object as the 2nd param, and the headers as the third like this:

axios.post(url, {}, header)

Let me know if that works!

Thanks,
Tommy