You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The third party API I am working with is asking me to generate the JWT on client side. I understand that they use the following code to verify JWT.
using System;
using System.Text;
using Microsoft.IdentityModel.Tokens;
using Microsoft.AspNetCore.Builder;
// The key length needs to be of sufficient length, or otherwise an error will occur.
var tokenSecretKey = Encoding.UTF8.GetBytes(Configuration["TokenSecretKey"]);
var tokenValidationParameters = new TokenValidationParameters
{
// Token signature will be verified using a private key.
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(tokenSecretKey),
ValidateIssuer = false,
ValidateAudience = false
};
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(options => { options.RequireHttpsMetaData = false;
options.SaveToken = true;
options.TokenValidationParameters = tokenValidationParameters;
});
In the client side the token generation I have created is as follows using Jose JWT.
return Jose.JWT.Encode(claims, byteArrayOfKey, Jose.JwsAlgorithm.HS256);
but the validation is failing with 401 on server side. Is there anything I can do match the server side.
The text was updated successfully, but these errors were encountered:
The third party API I am working with is asking me to generate the JWT on client side. I understand that they use the following code to verify JWT.
In the client side the token generation I have created is as follows using Jose JWT.
return Jose.JWT.Encode(claims, byteArrayOfKey, Jose.JwsAlgorithm.HS256);
but the validation is failing with 401 on server side. Is there anything I can do match the server side.
The text was updated successfully, but these errors were encountered: