Invalid sdk key error

I’m trying to join the meeting using web meeting-sdk.

It was not working with correct SDK key it throws Invalid sdkkey error in the dev console.

SDK version 2.7.0

C# code to generate the key
var iat = ToTimestamp(DateTime.UtcNow.ToUniversalTime()) - 30000;
var exp = iat + 7200;

    var sdkKey = "XXXXXXXXXXXXXXXXXXXXXXXXXX";
    var sdkSecret =  "YYYYYYYYYYYYYYYYYYYYYYYY";

    var claims = new List<Claim>
        {
            new Claim("app_key", sdkKey),
            new Claim("iat", iat.ToString(CultureInfo.InvariantCulture)),
            new Claim("exp", exp.ToString(CultureInfo.InvariantCulture)),
            new Claim("tpc", topic),
            new Claim("pwd", string.Empty)
        };

    var encoding = new ASCIIEncoding();
    byte[] keyByte = encoding.GetBytes(sdkSecret);
    var securityKey = new SymmetricSecurityKey(keyByte);
    var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);

    var secToken = new JwtSecurityToken(
           sdkKey,
           null,
           claims,
           DateTime.UtcNow,
           DateTime.UtcNow.AddHours(10),
           credentials);

    var handler = new JwtSecurityTokenHandler();
    signature = handler.WriteToken(secToken);

    return signature;
}

var iat = ToTimestamp(DateTime.UtcNow.ToUniversalTime()) - 30000;

iat in milliseconds ??? (30000 ms)

var exp = iat + 7200;

now you add 2 hours in seconds ??? (7200 seconds)

SDK JWT Signature:

there is no c# example yet

but here is a javascript example for generating signature for SDK JWT

here another javascript example

and here a php example

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