Using this template helps us debug your issues more effectively
Description
Hello team, I created a Chatbot App (account-level app), which receives notifications via web-hooks. And then I was trying to create a channel (from Node.js server) using /chat/users/{userId}/channels API. For this API, we need to send OAuth2 code, so I tried to call the below API to get OAuth2, but it was throwing below error
Error
{âreasonâ:âInternal Errorâ,âerrorâ:âinvalid_requestâ}
Below is the request I am using to get OAuth2 access token
request({
url: https://zoom.us/oauth/token?grant_type=authorization_code
,
method: âPOSTâ,
headers: {
âAuthorizationâ: 'Basic â + Buffer.from(process.env.zoom_client_id + â:â + process.env.zoom_client_secret).toString(âbase64â)
}
}, (error, httpResponse, body) => {
if (error) {
console.log('Error getting oauth2 access_token from Zoom. ', error)
} else {
console.log(body) // this is print internal error message.
}})
And then I tried to use JWT on behalf of OAuth2 access token while creating channel as follows:
let payload = { name: "sample channel", type:2};
let res2 = await axios.post('https://api.zoom.us/v2/chat/users/'+<user_id>+'/channels', payload, { headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + <JWT Token>
} });
let data = res2.data;
console.log("Successfully created channel:", data);
In this case, it threw the below error
data: {
code: 124,
message: 'This API only supports oAuth2 for authorization.'
}
Below are couple of questions, I have:
- To create a channel, can we use JWT on behalf of OAuth2?
- If we can use JWT, what is the right way to do that?
- If we can only use OAuth2, then do we need to create one more app OAuth2 (in addition to the already existing Chatbot App)? What are the exact steps that I need to follow to be able to create a channel from node.js server?
The full error message or issue you are running into.
Which App Type (OAuth / Chatbot / JWT / Webhook)?
I have created Chatbot App. To get JWT, I also created JWT app but it didnât help either.
Knowing the endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.
Which Endpoint/s?
How To Reproduce (If applicable)
Steps to reproduce the behavior:
- Request URL / Headers (without credentials) / Body
- See error
Screenshots (If applicable)
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.