I am getting 400 Bad Request while getting access token through auth code

const tokenResponse = await axios.post(“https://zoom.us/oauth/token”, null, {
params: {
code: code, // The authorization code you received
grant_type: “authorization_code”, // The type of OAuth flow being used
redirect_uri: process.env.ZOOM_REDIRECT_URI, // The redirect URI registered in Zoom
},
headers: {
“Authorization”: Basic ${Buffer.from(${process.env.ZOOM_CLIENT_ID}:${process.env.ZOOM_CLIENT_SECRET}).toString("base64")},
},
});

Error

{
“reason”: “Bad Request”,
“error”: “invalid_request”
}

I tried in postman as well I also got the same error

Hi @Bilal1
Could you please review the following post and let me know if that helps?

I am sending auth code from react js side and at backend nodejs I try to get the access and refresh token through that auth code

const tokenUrl = ‘https://zoom.us/oauth/token’;
const authHeader = Buffer.from(${clientId}:${clientSecret}).toString(‘base64’);
const data = qs.stringify({
grant_type: ‘authorization_code’,
code: code,
redirect_uri: redirectUri
});
console.log(‘data’, data)
console.log(‘authHeader’, authHeader)
const response = await axios.post(tokenUrl, data, {
headers: {
‘Content-Type’: ‘application/x-www-form-urlencoded’,
‘Authorization’: Basic ${authHeader}
}
});
console.log(‘response’, response)

your message not helping me so please help me in this where I am doing wrong

Can you please take a look at that guide, to understand the proper way to generate the oauth token? Here is another useful link to our docs:

POST https://zoom.us/oauth/token
HTTP/1.1

# Header
Host: zoom.us
Authorization: Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=
Content-Type: application/x-www-form-urlencoded

# Request body
code: [CODE]
grant_type: authorization_code
redirect_uri: [REDIRECT URI]

Here is a sample app that could be helpful too