在.net core 2.2中,当我对应用程序进行容器化时,出现Bearer错误=“ invalid_token”,error_description =“签名无效”
当我使用IIS / IIS Express在Windows上托管它时,它运行良好。
我的代码-令牌生成器是IBM API Connect,它使用RSA 256算法生成密钥
var rsa = new RSACryptoServiceProvider();
string exponentvalue = "AQAB";
var e = Base64UrlEncoder.DecodeBytes(exponentvalue);
var N = "public key put your value here"
var modulus = Base64UrlEncoder.DecodeBytes(N);
rsa.ImportParameters(
new RSAParameters()
{
Modulus = modulus,
Exponent = e
});
var signingKey = new RsaSecurityKey(rsa);
Run Code Online (Sandbox Code Playgroud)
var tokenValidationParameters = new TokenValidationParameters
{
// The signing key must match!
ValidateIssuerSigningKey = true,
IssuerSigningKey = signingKey,
// Validate the JWT Issuer (iss) claim …
Run Code Online (Sandbox Code Playgroud)