Server to server oauth issues

Hi,

This has been posted previously but I am still experiencing the same issue.
I am making a call to https://zoom.us/oauth/token?grant_type=account_credentials&account_id=
I supply my account id in the URL.
I am POST the following headers:
Authorization: Basic '. base64_encode(“$clientid:$secret”)

Which has been talked about on here many times.
I have enabled the permissions on my account for server-to-server.

However, i am still getting the following response:

{“reason”:“Invalid client_id or client_secret”,“error”:“invalid_client”}

I am going slightly mad with this…please help :slight_smile:

Regards
Colin

Hi @collin.taylor1 , what are you putting here?

It should be something like this: Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=

Note, above clientId:secret just for demo purposes.

Hi

Thanks for replying.
I’m getting the client id and secret from the portal, the resulting base64 encoded string is similar to what you are suggesting.
I have seen previous answers to this question in other posts and have done every solution they have suggested etc.

Thanks again for any help.

Interesting,

I have just been able to generate a token by using Postman but my PHP code is not working.
Do you have any examples of server-to-server auth PHP code?

Sorted it.

For anyone elses reference:

$url = "https://zoom.us/oauth/token?grant_type=account_credentials&account_id=" . $accountid;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array(        
    'grant_type'    => 'client_credentials',    # https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/        
    'scope'         => $scope,  
)));

$headers[] = "Authorization: Basic " . base64_encode($clientid . ":" . $secret);
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$data = curl_exec($ch);
$auth = json_decode($data, true); // token will be with in this json

var_dump( $auth );

Hi @colin1 ,

Thank you for sharing this code sample and glad it is resolved!

Best,
Gianni