{“code”:”124”,”message”:”Invalid access token”} error for User creation API using Asp.net api call?

public static string sGenerateJwtToken()
{

        // Token will be good for 20 minutes
        DateTime Expiry = DateTime.UtcNow.AddMinutes(20);

        string ApiKey = sApiKey;
        string ApiSecret = sApiSecret;

        string SdkKey = sSdkKey;
        string SdkSecret = sSdkSecret;

        int ts = (int)(Expiry - new DateTime(1970, 1, 1)).TotalSeconds;

        // Create Security key  using private key above:
        //var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(ApiSecret));
        var securityKey = new Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(SdkSecret));

        // length should be >256b
        var credentials = new SigningCredentials(securityKey, SecurityAlgorithms.HmacSha256);

        //Finally create a Token
        var header = new JwtHeader(credentials);

        //Zoom Required Payload
        var payload = new JwtPayload
        {  
            {"appKey",SdkKey},
           { "sdkKey", SdkKey },
           { "exp", ts },
        };

        var secToken = new JwtSecurityToken(header, payload);
        var handler = new JwtSecurityTokenHandler();

        // Token to String so you can use it in your client
        var tokenString = handler.WriteToken(secToken);

        return tokenString;

    }

Hi @nirmaltiwari139,

Were you able to verify that you are using the new token and not one that has expired? Would you be able to compare the two before making the API call?

Api call return token not matching with the existing token so only iam getting the error.

iam unable to comapre the token . thats the issue ?

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