AuthContext throwing SDKError 15

Description
When running CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().SDKAuth(param) with an AuthContext param, returns SDKError 15, which doesn’t have a value in the Enum so I’m unsure on the error.

Which version?
5.2.41727.0928

To Reproduce(If applicable)
Run the following code:

AuthContext param = new AuthContext();
param.jwt_token = "JWT TOKEN HERE";
SDKError err = CZoomSDKeDotNetWrap.Instance.GetAuthServiceWrap().SDKAuth(param);
if (err != SDKError.SDKERR_SUCCESS)
{
    MessageBox.Show("There was an error authorising with Zoom:" + err.ToString());
}

Screenshots
N/A

Additional context
Authorising with an AuthParam and appKey/appSecret works fine.

Hi @Proddy,

Thanks for the reply. The error code indicates that the JWT token is invalid. Please follow the instruction here to generate the JWT token: https://github.com/zoom/zoom-c-sharp-wrapper#initializing-sdk-with-jwt-token

And here is a handy python script that could be helpful to generate the JWT token:

    iat = long(int(time.time()))
    exp = long((datetime.datetime.today() + datetime.timedelta(days=2)).strftime("%s"))
    tokenExp = long((datetime.datetime.today() + datetime.timedelta(hours=1)).strftime("%s"))

    payload = {
        'appKey': key,
        'iat': iat,
        'exp': exp,
        'tokenExp': tokenExp
    }
    encoded = jwt.encode(payload, secret, algorithm='HS256')

Hope this helps. Thanks!

Hi Carsen,

Thanks for getting back to me. I’d seen that Python snippet on another thread and tried to do that with Microsoft.IdentityModel.Tokens and the following code:

Dim appKey As String = "Key"
Dim appSecret As String = "Secret"
Dim iat As Long = DateTimeOffset.UtcNow.ToUnixTimeSeconds
Dim exp As Long = iat + 60 * 60
Dim securityKey As New SymmetricSecurityKey(Encoding.UTF8.GetBytes(appSecret))
Dim credentials As New SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256)
Dim header As New JwtHeader(credentials)
Dim payload As New JwtPayload()
payload.AddClaim(New Claim("appKey", appKey))
payload.AddClaim(New Claim("iat", iat))
payload.AddClaim(New Claim("exp", exp))
payload.AddClaim(New Claim("tokenExp", exp))
Dim secToken As New JwtSecurityToken(header, payload)
Dim handler As New JwtSecurityTokenHandler()
Dim token As String = handler.WriteToken(secToken)

However that’s the token that was causing SDKError 15. Can you noticed anything wrong with that?

Thanks,
Josh