"Invalid client_id or client_secret"

https://zoom.us/oauth/token?grant_type=authorization_code&code={my code}&redirection_uri={my callback URL}

Making a POST Request to the above URL shows

{
    "reason": "Invalid client_id or client_secret",
    "error": "invalid_client"
}

I’m not quite sure what the issue is. I had copy pasted the correct client ID before generating the code.

Please help! This issue is really driving me nuts.

1 Like

Hey @abhilash,

Did you include the required Authorization header in your request?

"Authorization": "Basic base64Encode(Client_Id:Client_Secret)"

(You can base64encode them here. Make sure to include the : in between your client_id and client_secret)

It will look something like this
"Authorization": "Basic YXNkZmFzZGZha3M6YWRramZiYXNrbGRqZmFzZGY="

Also, you need to change redirection_uri to redirect_uri.

Let me know if this works!

Thanks,
Tommy

3 Likes

Worked like a charm.
Also took a look at the documentation. Apologies for missing it.

1 Like

Glad it worked, no apology necessary!

We are happy to help! :slight_smile:

The same issue I’m struggling with. I am trying to get OAuth app authorization working in C# code via authorization code flow. JWT app is quite simple and easy. I got it easily working. I got the authorization code but failed to get access token. POST url is like this. https://zoom.us/oauth/token?code={authorizationCode}&grant_type=authorization_code&redirect_uri=https://zoom.us
The redirect_uri is same as what’s registered with my app and white listed also. In the Authorization header I give “Bearer Base64(Client_Id:Client_Secret)” . For base64 encoding, I have used https://www.base64encode.org/, character set is UTF8, destination new line separator LF (Unix). I am on Windows 10. I don’t think LF (Unix) cause problem here. I get exact same error as OP. It’s not working in C# code and from postman also.

image

@Kadiri Hi, according to the docs you should use Basic instead of Bearer.

2 Likes

That’s the culprit. Thanks for pointing this out.

1 Like

Hey @Kadiri,

It needs to use Basic, not Bearer.

"Authorization": "Basic Base64(Client_Id:Client_Secret)"

Thanks for your help @andrii.vandakurov! :slight_smile:

Thanks,
Tommy

Hi there,

i am currently experiencing the same problem, i am using the oauth flow

my steps are:

  1. I get the authorization code by hitting the /oauth/authorize endpoint
  2. using the given code i then do an axios.post
    function token(data) {
        return new Observable(async (subscriber) => {
          try {
            const { root } = host
            const client = process.env.ZOOM_CLIENT_ID
            const secret = process.env.ZOOM_CLIENT_SECRET
            const raw = `${client}:${secret}`
            console.log('client: ', client)
            console.log('secret: ', secret)
            console.log('raw: ', raw)
      
            const authorization = Buffer.from(raw, 'utf8').toString('base64')
            console.log('authorization: ', authorization)
      
            const test = Buffer.from(authorization, 'base64').toString('utf8')
            console.log('test: ', test)

            const redirectUri = process.env.ZOOM_REDIRECT_URI //currently set to: http://localhost:3000/auth/callback/zoom 
      
            const options = {
              url: `/oauth/token?grant_type=authorization_code&code=${data.payloads.code}&redirect_uri=${redirectUri}`,
              headers: {
                Authorization: `Basic ${authorization}`,
              },
            }
      
            console.log('zoom token options: ', options)
            const result = await root.post(options.url, {}, options.headers)
      
            subscriber.next(result)
            subscriber.complete()
          } catch (error) {
            if (error.response) {
              subscriber.error(error.response.data.error)
            } else {
              subscriber.error(error)
            }
          }
        })
      }

the console.logs is for me to double check on things, and it seems that it is giving me the correct values

i tried encoding using Buffer.from(raw, 'utf8').toString('base64') and Buffer.from(raw, 'binary').toString('base64')

but still getting the invalid_client as response

is there something i missed?

Hey @littlechad,

Thanks for sharing these details. Do you run into the same error when you test this request in Postman or using cURL?

Thanks,
Will

i havent, will try it real quick, and get back to you

thanks

UPDATE: thanks for the hints, i think i manage to make this work, as it turns out that i need to put the query params as part of the 3rd argument on axios

Ah, I see! Glad to hear it seems to be working now, @littlechad :slight_smile:

Best,
Will

Hello Tommy,
I’m using post man for this, and I have also tried this on our application but got same error.
Error : {
“reason”: “Invalid client_id or client_secret”,
“error”: “invalid_client”
}
I have done all the below mention steps.
Step 1:Got the code=obBEe8ewaL_KdyNjniT4KPd8ffDWt9fGB in query parameter.
Step 2: POST request on [zoombaseUrl]/oauth/token?code=0TSK33beUP_n7fue5iHRaOv6Crm_BlGGg&grant_type=authorization_code&redirect_uri=https://oauth.pstmn.io/v1/callback
WITH HEADERS
Authorization:"Basic " ,
Content-Type:“application/x-www-form-urlencoded”

To generate Authorization value I have followed all the steps mention (https://marketplace.zoom.us/docs/guides/auth/oauth) here I have included : between clientId and ClientSecret and then I have encoded them together with :,using base64encode.org/,
I have tried all the solutions mention on these page, please let me know what may be other possible reason for this problem.

After what you type of changing your error gone? Can you help me out too?

Hey @irfanshaikh,

Have you double checked that the Client ID and Client Secret in your Authorization header matches that of your OAuth App? Additionally, if your app has both production and development credentials, make sure you’re specifying the same credentials as the instance of the app you authorized.

Thanks!

Hi .

We have double check the Client ID and Client secret. We have follow all the steps in document. Try all the possible way.
Currently we have only with development.

Waiting for solution.

Hi @irfanshaikh,

Can you please share the full details of your request with us by opening up a request here (select the ‘developer’ product from the dropdown, after choosing Technical Support). Share the Client ID/Secret of your app, the Authorization header you’re passing, and the full request URL.

Thanks,
Will