How to generate signature for OAuth app type

Description
I cannot join the meeting using Web SDK & Oauth app(ClientId, ClientSecret)
Error I receive : {method: ‘join’, status: false, result: ‘Invalid signature.’, errorMessage: ‘Signature is invalid.’, errorCode: 3712}

Browser Console Error
{method: ‘join’, status: false, result: ‘Invalid signature.’, errorMessage: ‘Signature is invalid.’, errorCode: 3712}

Which Web Meeting SDK version?
2.9.0

Additional context
The way I am generating signature on the backend :

    private static string GenerateZoomSignatureForNewApps(string key, string secret, string meetingNumber, string role)
    {
        var header = new
        {
            alg = "HS256",
            typ = "JWT"
        };
        var headerBytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(header));
        var base64UrlHeader = Base64UrlEncode(headerBytes);

        var iat = (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds - 400;
        var expirationSecondsToAdd = 7200;
        var exp = iat + expirationSecondsToAdd;

        var payload = new
        {
            appKey = key,
            sdkKey = key,
            mn = meetingNumber,
            role = role,
            iat = iat,
            exp = exp,
            tokenExp = exp
        };

        var jsonPayload = JsonConvert.SerializeObject(payload);
        var payloadBytes = Encoding.UTF8.GetBytes(jsonPayload);
        var base64UrlPayload = Base64UrlEncode(payloadBytes);

        var message = $"{base64UrlHeader}.{base64UrlPayload}";
        var keyBytes = Encoding.UTF8.GetBytes(secret);

        using var hmacsha256 = new HMACSHA256(keyBytes);
        var signatureBytes = hmacsha256.ComputeHash(Encoding.UTF8.GetBytes(message));
        var signature = Base64UrlEncode(signatureBytes);

        return signature;

        static string Base64UrlEncode(byte[] input)
        {
            string base64 = Convert.ToBase64String(input);
            return base64.Replace("+", "-").Replace("/", "_").TrimEnd('=');
        }
    }

frontend:

                        ZoomMtg.join(
                            {
                                meetingNumber: data.meetingNumber,
                                userName: data.userName,
                                signature: data.signature,
                                sdkKey: data.clientId,
                                userEmail: data.userEmail,
                                passWord: data.passWord,
                                success: function (res) {

@pbudzyn,

Thank you for posting in the Zoom Developer Forum. To begin, please share which Marketplace type App you are using to authenticate the Meeting SDK. You should be using the Meeting SDK Marketplace-type App, here is our help documentation o that :

Create a Meeting SDK App

https://developers.zoom.us/docs/meeting-sdk/create/

Authorization

https://developers.zoom.us/docs/meeting-sdk/auth/

I have created OAuth app in the marketplace.
Should I also create the Meeting SDK app to be able to join the meetings?

@pbudzyn,

Yes, to authorize the SDK you need to create a Meeting SDK Marketplace app.

@donte.zoom Thanks, I have managed to join the meeting!
I have another problem now when the second participant joins the meeting Zoom Client freezes because https://source.zoom.us/2.11.0/lib/av/vb-resources/tf.min.js cannot be loaded. It is in a pending state for the second participant. Do you know what could be the reason?

@pbudzyn ,

Glad to you are able to join the meeting. Regarding the second matter, can you share a screenshot of browser’s console? Also, please share a screenshot of the network tab when the user tries to join.

@donte.zoom

I have compared requests and the only difference between the first and second user is this tf.min.js request

Maybe the problem is not in this file, but this file is not loaded because the tab freezes and Chrome consumes more and more memory every second

One more screenshot

@pbudzyn,

Are you still seeing the same behavior or has it resolved?

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