# Cannot Authenticate my Server to Server app and get my first token

**URL:** <https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154>\
**Category:** Authentication\
**Created:** [October 3, 2023, 8:49am UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154 "2023-10-03T08:49:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![thierry](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/thierry/32/52681_2.png) [@thierry](https://devforum.zoom.us/u/thierry)\
**Post date:** [October 3, 2023, 8:49am UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/1 "2023-10-03T08:49:50Z")

</div>

Hello everybody,

**API Endpoint(s)**: [https://zoom.us/oauth/token](https://zoom.us/oauth/token)  
**Description** : After registering my Server to Server app, I am trying to get my first OAuth token.  
I am using cURL language as follows:

- -X -H “Content-Type: application/x-www-form-urlencoded” -H “Authorization: Basic Base64Encoded(clientId:clientSecret)” -d “grant\_type=account\_credentials” -d “account\_id={accountID}” -D $header --trace $trace

**Comment** : I obviously compute and replace the proper Base64Encoded(clientId:clientSecret) et {accountID}

**Error?**  
_405 Method Not Allowed_

I am the owner and only user of the Zoom account and I have a Pro license.  
I checked the role-based access permissions but given I am owner I cannot change anything.  
Are my full credentials passed on the Server to Server app?

Thank you in advance

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [October 3, 2023, 4:00pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/3 "2023-10-03T16:00:36Z")

</div>

Hi @thierry ,

I believe the error lies here:

> [@thierry](#):
>
> “Content-Type: application/x-www-form-urlencoded”

No content-type needed. Please see Postman workspace template for S2S token generation and code samples:

[https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/request/22097587-875f65b4-d88f-4082-80af-7605303a5abc?ctx=code](https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/request/22097587-875f65b4-d88f-4082-80af-7605303a5abc?ctx=code)

---

<div class="post-metadata">

**Author:** ![thierry](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/thierry/32/52681_2.png) [@thierry](https://devforum.zoom.us/u/thierry)\
**Post date:** [October 3, 2023, 5:24pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/4 "2023-10-03T17:24:51Z")

</div>

Hi @gianni.zoom,

I just tried and unfortunately it is still not working (same error) even though you are right.  
I checked again the [Server-to-Server OAuth](https://developers.zoom.us/docs/internal-apps/s2s-oauth/) page and I mistakenly followed the code as if I were using PowerShell.  
Next step is to follow your lead at Postman and I can already see that it is different from API doc.  
I’ll post the solution once I find it.  
Thank you again for your help.

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [October 3, 2023, 5:57pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/5 "2023-10-03T17:57:53Z")

</div>

Hi @thierry ,

Ahh, try referring to this thread:

cURL:

> [@Server-to-Server OAuth returns 400 when requesting access token - Powershell](https://devforum.zoom.us/t/server-to-server-oauth-returns-400-when-requesting-access-token-powershell/76999/2):
>
> Hi, @zoom123, Thank you for posting in the Developer Forum – I am happy to help. Sorry to hear that you getting 400 bad request. Can you try to make the request with the following curl command : curl --location --request POST 'https://zoom.us/oauth/token?grant\_type=account\_credentials&account\_id={accountId}' \ --header 'Authorization: Basic Base64Encoder(clientId:clientSecret)' \ --data-raw '' Also, there is a helpful utility script to generate a Zoom Server-to-Server Oauth Token and copy it …

Powershell:

> [@Server-to-Server OAuth returns 400 when requesting access token - Powershell](https://devforum.zoom.us/t/server-to-server-oauth-returns-400-when-requesting-access-token-powershell/76999/6):
>
> Some potential areas you may want to check: Use a single-byte encoding like ASCII or UTF-8. Encode using base64url encoding, which replaces certain characters and discards padding. Actually, my current Server-to-Server OAuth implementation is using base64 encoding; it was JWT that used base64url encoding. A .NET Framework / PowerShell compatible implementation for both of the above might be available via [Microsoft.IdentityModel.Tokens.Base64UrlEncoder.Encode](https://learn.microsoft.com/en-us/dotnet/api/microsoft.identitymodel.tokens.base64urlencoder.encode).

---

<div class="post-metadata">

**Author:** ![thierry](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/thierry/32/52681_2.png) [@thierry](https://devforum.zoom.us/u/thierry)\
**Post date:** [October 3, 2023, 6:13pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/6 "2023-10-03T18:13:05Z")

</div>

> [@Server-to-Server OAuth returns 400 when requesting access token - Powershell](https://devforum.zoom.us/t/server-to-server-oauth-returns-400-when-requesting-access-token-powershell/76999/2):
>
> –location --request POST ‘[https://zoom.us/oauth/token?grant\_type=account\_credentials&account\_id={accountId}](https://zoom.us/oauth/token?grant_type=account_credentials&account_id=%7BaccountId%7D)’ \ –header ‘Authorization: Basic Base64Encoder(clientId:clientSecret)’ \ –data-raw ‘’

@Gianni,  
I am still working to understand what is going on because :

- Following your lead, I was able to generate a token with postman (had to make a branch in my workspace that’s all)

- Usually I am pretty good (I have about 15 API under my belt) at translating Postman cURL for my environment (I am integrating Zoom in FileMaker database) but so far no luck.

- It is a syntax problem, my base64 encoding is correct because I have same result as Postman and Postam was successful at getting a token.

As mentioned, I’ll keep the forum updated once I find the solution.

Thanks again

---

<div class="post-metadata">

**Author:** ![thierry](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/thierry/32/52681_2.png) [@thierry](https://devforum.zoom.us/u/thierry)\
**Post date:** [October 3, 2023, 8:55pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/7 "2023-10-03T20:55:04Z")

</div>

Hi @gianni.zoom,

I finally found the problem, it was syntax. Base64 has several format so in my case I must use:  
_"Basic " & Base64EncodeRFC ( 3548 ; ( $Client\_ID & “:” & $Client\_Secret ) )_  
RFC 3548 means “No line breaks added”  
When using Base64Encode in my application an invisible pilcrow was added.  
Thank you very much for your help…

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [October 4, 2023, 2:57pm UTC](https://devforum.zoom.us/t/cannot-authenticate-my-server-to-server-app-and-get-my-first-token/96154/8 "2023-10-04T14:57:07Z")

</div>

Hi @thierry , thanks for updating us and sharing your solution!
