Help Generate SDK With Net Core 6

My name is Leonardo. I created an app-server-to-server and already got ApiKey, ApiSecret, ClientID.

Following the forum, I found an example in C# of how to generate the signature using my apikey and apisecret.

Every time I try to use the signature in Angular I get an error of ‘SdkKey invalid’ or sometimes ‘Signature invalid’

C# Post Method
[HttpPost(“GenerateSignatureZoom”)]
public string GenerateSignature(long meetingNumber, int role)
{
string apiKey = “wc2yJ3WxQ8ai1LQD37v48w”;
string apiSecret = “BCbtD8C3DSG0hJprqsLkoZZHn7P08tu6”;
long ToEpoch(DateTime value) => (value.Ticks - 621355968000000000) / (10000 * 1000);

        var now = DateTime.UtcNow;
        var iat = ToEpoch(now);
        var exp = ToEpoch(now.AddDays(1));
        var payload = new Dictionary<string, object>()
        {
            { "appKey", apiKey },
            { "sdkKey", apiKey },
            { "mn", meetingNumber },
            { "roll", roll },
            { "iat", iat },
            { "exp", exp },
            { "tokenExp", exp },
        };
        return Jose.JWT.Encode(payload, Encoding.UTF8.GetBytes(apiSecret), JwsAlgorithm.HS256);
    }

Angular
startMeeting() {

let meetingSDKElement = document.getElementById('meetingSDKElement');

this.ngZone.runOutsideAngular(() => {
  this.client.init({zoomAppRoot: meetingSDKElement, language: 'en-US'}).then(() => {
    this.client.join({
      signature: this.signature,
      sdkKey: this.sdkKey,
      meetingNumber: this.meetingNumber,
      password: this.passWord,
      userName: this.userName,
      userEmail: this.userEmail,
      tk: this.registrantToken,
      zak: this.zakToken
    }).then(() => {
      console.log('joined successfully')
    }).catch((error) => {
      console.log(error)
    })
  }).catch((error) => {
    console.log(error)
  })
})

}

Hi @leonardosfrancisco !

Welcome to the Zoom Developer community. You cannot use the Server-to-Server OAuth application credentials with the SDKs. You must use the Meeting SDK credentials to generate the signature.

Here’s the documentation you need:

Hi Gianni

I admit I’m lost in the documentation. In MeetingSDK I only have ClientID and ClientSecret. I’m using the address https://zoom.us/oauth/token?grant_type=account_credentials&account_id={accountId} to generate the Token, but in the MeetingSDK there is no AccountId (I don’t know where to find it).

What is the endpoint to generate Access Token to MeetingSDK?

Can you please clarify these doubts for me?

Hi @leonardosfrancisco no worries!

You cannot use the Server-to-Server OAuth URL with Meeting SDK credentials. The URL you used is for Server-to-Server OAuth app. Server-to-Server OAuth app is for internal application data access.

Since you are using Meeting SDK, please follow the guidance here: Meeting SDK Auth

You will use your Meeting SDK client id and client secret to generate a SDK JWT/signature that allows you to join/start meetings:

image

If you want to access the Zoom Open API endpoints at a later point, you can use your MSDK client id and client secret to generate an OAuth access token.

You can also create a Server-to-Server OAuth or standard OAuth app type and run through the process to get to the endpoints.

Gianni,

I fixed it and created a MeetingSDK. Thank you for the response.

I’m having trouble generating the access token now.

You can use this access token to make requests to the Zoom API, the documentation is confusing on how to use the endpoint https://zoom.us/oauth/token

The code I used is giving an Invalid Token or Bad Request error.

Hi @leonardosfrancisco ,

If you’re using an OAuth app, follow this guide: Create an OAuth app

For Server-to-Server: Internal apps (Server-to-server)

You can also use our Postman workspace to help with authentication: Postman

Hi @gianni.zoom

I appreciate your help and patiente.

GET oauth/token?response_type=code&client_id={{oAuthDevClientId}}&redirect_uri={{oAuthDevRedirectUri}}
OR
GET oauth/authorize?response_type=code&client_id={{oAuthDevClientId}}&redirect_uri={{oAuthDevRedirectUri}}

If it is a token at the end (gives status 405 Method Not Allowed) and if it is authorize at the end (it only brings HTML from a page other than the one I configured in the MeetingSDK and does not bring the code)

POST https://zoom.us/oauth/token
I configured using Postman Authorization Tab and generated the code. But the method gives status 400

Are the Apis really up to date? Why do I do the same procedure and path and it gives an error? I’m sure my configuration in MeetingSDK is correct.

I want creat it in my backend Net Core. Please help me

Hi @leonardosfrancisco ,

Sorry for the confusion! Can you please clarify which app type you are using to access the Zoom APIs?

Let’s back track and use the Meeting SDK credentials:

If you have your MSDK set to “intend to publish: yes”, you will have both development and production app credentials. If you have your MSDK set to “intend to publish: no”, you will just have one set of credentials.

Please take those credentials, and follow the OAuth process:

If you’d like to do the OAuth process with PKCE, you can reference the docs here:

I recommend getting your access token using our public workspace since it is your first time.

For help on how to use the workspace, please see the instructions and tutorials here.