Unable to generate OAuth token receiving 400 Bad Request error
@Sivakumar I’m doing something like this on nodejs
app.get(‘/oauthrefreshtoken’, async (req, res) => {
const refreshToken = req.query.code;
const clientId = process.env.ZOOM_OAUTH_USERLEVEL_CLIENT_ID;
const clientSecret = process.env.ZOOM_OAUTH_USERLEVEL_CLIENT_SECRET;
if (!refreshToken) {
return res.status(400).json({ error: ‘Missing ?code=refresh_token parameter’ });
}
try {
const credentials = Buffer.from(`${clientId}:${clientSecret}`).toString(‘base64’);
const response = await axios.post(
‘https://zoom.us/oauth/token’,
new URLSearchParams({
refresh_token: refreshToken,
grant_type: ‘refresh_token’,
}).toString(),
{
headers: {
Authorization: `Basic ${credentials}`,
‘Content-Type’: ‘application/x-www-form-urlencoded’,
},
}
);
res.status(200).json(response.data);
} catch (error) {
res.status(500).json({ error: error.response?.data || error.message });
}
});
If you put in your refresh token to jwt.io, you should be able to see details like expiry date etc..
I’ve dedacted my own refresh token, but it should be like this format
eyJzdiI6IjAwMDAwMiIsImFsZyI6IkhTNTEyIiwidiI6IjIuMCIsImtpZCI6IjlhYmQwNjc0LWE3ZmUtNDhiMy04ZDU5LTQ4MTE4Y2I1ZWI5OSJ9.eyJhdWQiOiJodHRwczovL29hdXRoLnpvb20udXMiLCJ1aWQiOiJwSjhaR2tBRVFzU0w3eHlSaWFaU1ZBIiwidmVyIjoxMCwiYXVpZCI6ImFkMmUyMzc1NWExY2Q5ZjhiYmQ3ZDBhMzQ0NDhlMWEzZWYwOWEwYTI5MzE0NDM5MmY2ZjA0YmI0MTRlZTAyZDAiLCJuYmYiOjE3Nzg1NjgwOTYsImNvZGUiOiJRTGgzMjRLNjxxxxxxxxxxxxxxxxxxxxxx3Nzg1NjgwOTYsImFpZCI6IjlzU19QQjJ5UjgyN25tdHNzZzl3Z1EifQ.E_lD62P1q9wzggN1EwExOSTTqgTLB9ar-63ijTtUSMXX4xxxxxxxxxxxxxxxeFTS4q1Iw
The refresh_token you are providing looks more like an initial code to request for access and refresh token

