Bilal1
(Bilal)
February 11, 2025, 2:14pm
1
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?
To publish an app on the Zoom Marketplace you must create an OAuth app .
When you’re ready to test making API calls, download the latest version of Postman and import the Zoom API collections following the steps outlined here .
There are Three Ways to Set up OAuth in Postman to Make API Requests
We’re going to go through three ways to set up our OAuth application credentials to successfully authorize and access the Zoom API to make requests.
The “Easy” Difficulty OAuth 2.0 Set Up in Postman
We’…
Bilal1
(Bilal)
February 13, 2025, 7:12am
3
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
const express = require('express');
const axios = require('axios');
const qs = require('query-string');
const {
createNewUser, getCurrentUser, getUsers, updateCurrentUserToken, deleteCurrentUser,
} = require('../../dbQuery');
const { decrypt } = require('../../crypto');
const withCurrentUser = require('../../middlewares/withCurrentUser');
const httpErrorHandler = require('../../httpErrorHandler');
const logHttpErrorPath = require('../../logHttpErrorPath');
const {
ZOOM_OAUTH_TOKEN_URL, ZOOM_OAUTH_AUTHORIZATION_URL, ZOOM_API_BASE_URL, ZOOM_TOKEN_RETRIEVED,
ZOOM_USER_REVOKE_ERROR, ZOOM_TOKEN_ERROR, ZOOM_TOKEN_REFRESH_ERROR,
ZOOM_OAUTH_ERROR, ZOOM_FETCH_OAUTH_USERS_ERROR,
} = require('../../constants');
const router = express.Router();
// Zoom OAuth
router.get('/', async (req, res) => {
This file has been truncated. show original