Code: 124 , This API does not support client credentials for authorization

Format Your New Topic as Follows:

API Endpoint(s) and/or Zoom API Event(s)
Link the API endpoint(s) and/orZoom API Event(s) you’re working with to help give context.

Description
We tried to convert JWT to OAuth, but encountered difficulties. I did not get the Token, but I called the Zoom Api to create a Meeting in response to this message. Instead, I used “account_credentials” and “client_credentials”. We hope to create a meeting or initiate a meeting in the background.

ApiURL:https://api.zoom.us/v2
requestURL:POST /users/{email}/meetings

Error?
{
“code”: 124,
“message”: “This API does not support client credentials for authorization.”
}

How To Reproduce
The code is rather simple.

var Str_token = @“XXXXXXX”;
var client = new RestClient(@“https://api.zoom.us/v2”);
email = @“XXX@xxx.xxx.xx”;
var request = new RestRequest($“/users/{email}/meetings”, Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddJsonBody(jsonData);
request.AddHeader(“content-type”, “application/json”);
request.AddHeader(“authorization”, $“Bearer {Str_token}”);

IRestResponse response = client.Execute(request);
var content = JsonConvert.DeserializeObject(response.Content);

@show10665 , how are you generating your Str_token ?

I used the following code to get Token.

string tokenUrl = @"https://zoom.us/oauth/token";
string clientId = "xxxx";
string clientSecret = "xxxx";
string redirectUri = "xxxx";
string AuthorizationBasic = Convert.ToBase64String(Encoding.UTF8.GetBytes(clientId + ":" + clientSecret));
RestClient client = new RestClient(new Uri(tokenUrl));
RestRequest request = new RestRequest();
request.Method = Method.POST;

request.AddHeader("Authorization", $"Basic {AuthorizationBasic}");
request.AddHeader("content-type", "application/x-www-form-urlencoded");
request.AddParameter("grant_type", "client_credentials");
request.AddParameter("redirect_uri", redirectUri);
request.AddParameter("client_id", clientId);
request.AddParameter("client_seret", clientSecret);
IRestResponse response = client.Execute(request);

@show10665 can i confirm if you are using Server to Server Oauth or Oauth?

Server to Server Oauth and Oauth I’ve tried both and the results are still the same.

@show10665,

If you are using Server to Server Oauth, here’s what I did in nodejs to get the bearer token

// Function to fetch a bearer token
async function fetchBearerToken() {
  try {
    // Create a Basic Authorization header with client credentials
    const credentials = Buffer.from(`${process.env.ZOOM_S2S_CLIENT_ID}:${process.env.ZOOM_S2S_CLIENT_SECRET}`).toString('base64');
    const apiUrl = `https://zoom.us/oauth/token?grant_type=account_credentials&account_id=${process.env.ZOOM_S2S_ACCOUNTID}`;
    
    // Define the token request parameters
    const tokenRequestData = {
      method: 'POST',
      url: apiUrl,
      headers: {
        'Authorization': `Basic ${credentials}`,
        'Content-Type': 'application/x-www-form-urlencoded',
      },
      
    };

    // Send the token request
    const response = await axios(tokenRequestData);

    // Extract the access token from the response
    const accessToken = response.data.access_token;
    // Return 
    return accessToken;
   
  } catch (error) {
    return error.message;
  }
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.