Description
Create token in asp.net using JWT,
Error
Invalid Token
Which App Type (OAuth / Chatbot / JWT / Webhook)?
JWT
Which Endpoint/s?
How to create Zoom Token to create meeting using JWT authentication,
How To Reproduce (If applicable)
Steps to reproduce the behavior:
Please find the code below iam using
string key = "xxxxxxxxxxxxxxxx";
// Create Security key using private key above:
// not that latest version of JWT using Microsoft namespace instead of System
var securityKey = new Microsoft
.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.UTF8.GetBytes(key));
// Also note that securityKey length should be >256b
// so you have to make sure that your private key has a proper length
//
var credentials = new Microsoft.IdentityModel.Tokens.SigningCredentials
(securityKey, SecurityAlgorithms.HmacSha256Signature);
var header = new JwtHeader(credentials);
var exp = "1516239022";
// Finally create a Token
Header = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}";
var Payload1 = new JwtPayload
{
{ "iss ", "xxxxxxxx"},
{ "exp", "1516239022"},
};
var secToken = new JwtSecurityToken(header, Payload1);
var handler = new JwtSecurityTokenHandler();
// Token to String so you can use it in your client
var tokenString = handler.WriteToken(secToken);
Console.WriteLine(tokenString);
Console.WriteLine("Consume Token");
// And finally when you received token from client
// you can either validate it or try to read
var token = handler.ReadJwtToken(tokenString);
Additional context
Can you please provide any sample to generate JWT. We created the JWT successfully using https://jwt.io/ but getting invalid token when we integrate in our code base