SDK Authorization failed MobileRTCAuthError(rawValue: 11) and Invalid signature

Hi, I’m currently integrating Zoom Meeting SDK version 5.17.10 into my application. I’ve implemented the OAuth flow, starting with the creation of an OAuth token (using server-to-server OAuth). From there, I generated a ZAK token, and finally, I created a JWT for the Meeting SDK. However, when I use this JWT token in my iOS application, I encounter an error: ‘SDK Authorization failed’ with error code MobileRTCAuthError(rawValue: 11). Could anyone please help me identify the issue?
header {
“alg”: “HS256”,
“typ”: “JWT”
} payload like this {
“appKey”: ZOOM_MEETING_SDK_KEY_OR_CLIENT_ID,
“sdkKey”: ZOOM_MEETING_SDK_KEY_OR_CLIENT_ID,
“mn”: MEETING_NUMBER,
“role”: ROLE,
“iat”: 1646937553,
“exp”: 1646944753,
“tokenExp”: 1646944753
}
HMACSHA256(
base64UrlEncode(header) + ‘.’ + base64UrlEncode(payload),
ZOOM_MEETING_SDK_SECRET_OR_CLIENT_SECRET
);

@farooqih11 ,

Auth Signature / JWT Token for Meeting SDK does not require OAuth Flow.

You will need to create either a Meeting SDK App (Legacy), or General App (with Meeting SDK Function enabled), use the Client ID and Client Secret to sign the token.

@chunsiong.zoom hi, I have sign the token with clientId and Clientsecret but still getting same error. please help in finding the exact issue. here is my code for generating token…
public static string GenerateSignature(string clientId, string clientSecret, long meetingNumber, int role)
{
// Prepare the header
var header = new Dictionary<string, object>
{
{ “alg”, “HS256” },
{ “typ”, “JWT” }
};
string headerJson = Newtonsoft.Json.JsonConvert.SerializeObject(header);

    // Convert the headerJson string to a byte array
    byte[] headerBytes = Encoding.UTF8.GetBytes(headerJson);
    string base64UrlEncodedHeader = Base64UrlEncode(headerBytes);

    // Prepare the payload
    var payload = new Dictionary<string, object>
    {
        { "appKey", clientId },
        { "sdkKey", clientId }, // sdkKey is deprecated but still included for compatibility
        { "mn", meetingNumber },
        { "role", role },
        { "iat", (long)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds },
        { "exp", (long)(DateTime.UtcNow.AddHours(2).Subtract(new DateTime(1970, 1, 1))).TotalSeconds },
        { "tokenExp", (long)(DateTime.UtcNow.AddHours(2).Subtract(new DateTime(1970, 1, 1))).TotalSeconds }
    };
    string payloadJson = Newtonsoft.Json.JsonConvert.SerializeObject(payload);

    // Convert the payloadJson string to a byte array
    byte[] payloadBytes = Encoding.UTF8.GetBytes(payloadJson);
    string base64UrlEncodedPayload = Base64UrlEncode(payloadBytes);

    // Concatenate the base64UrlEncodedHeader and base64UrlEncodedPayload with a period
    string dataToSign = base64UrlEncodedHeader + '.' + base64UrlEncodedPayload;

    // Hash the concatenated data using HMAC SHA256
    byte[] signatureBytes;
    using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(clientSecret)))
    {
        signatureBytes = hmac.ComputeHash(Encoding.UTF8.GetBytes(dataToSign));
    }

    if (signatureBytes == null)
    {
        throw new InvalidOperationException("Signature cannot be null.");
    }

    // Encode the signature bytes to Base64 URL format
    string signature = Base64UrlEncode(signatureBytes);

    return dataToSign + '.' + signature;
}

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

}

@farooqih11 I’ll PM you for the JWT Token and meeting details

1 Like