Unexpected JWT alg received, expected HS256, got: RS256
See original GitHub issueI am having issues using HS256
signing algorithm:
BadRequestError: unexpected JWT alg received, expected HS256, got: RS256 at /<project-path>/node_modules/express-openid-connect/middleware/auth.js:121:19 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:95:5)
server.js
app.use(
auth({
authRequired: true,
idpLogout: true,
idTokenSigningAlg: 'HS256',
issuerBaseURL: process.env.ISSUER_BASE_URL,
clientID: process.env.CLIENT_ID,
authorizationParams: {
response_type: "code",
audience: process.env.AUDIENCE,
scope: "openid profile email",
},
})
);
.env
CLIENT_ID=Kr***********************WhTI
BASE_URL=http://localhost:3000
CLIENT_SECRET=wd************************************************tRLg99
AUDIENCE=https://my-audience
SECRET=0y************************ySlx
ISSUER_BASE_URL=https://mydomain.auth0.com
PORT=3000
Dependencies:
"express": "4.18.1",
"express-openid-connect": "2.8.0",
"express-session": "^1.17.3",
– node v14.17.6
Am I missing something?
I also added a console.log in /node_modules/express-openid-connect/middleware/auth.js
to print client
object, and I got:
Client {
authorization_signed_response_alg: 'RS256',
client_id: 'Kr**********************hTI',
client_secret: 'wdj***************************************RLg99',
grant_types: [
'authorization_code'
],
id_token_signed_response_alg: 'HS256',
response_types: [
'code'
],
revocation_endpoint_auth_method: 'client_secret_basic',
token_endpoint_auth_method: 'client_secret_basic'
}
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
unexpected JWT alg received, expected HS256, got: RS256
I am trying to use express-openid-connect: 2.7.3 with HSHS256 signing algorithm. I am getting this error: BadRequestError: unexpected JWT ...
Read more >"failed to validate JWT signature" #21 - auth0/nextjs ... - GitHub
Mine was originally set to RS256 , I changed it to HS256 just to double check and got unexpected JWT alg received, expected...
Read more >express-openid-connect: unexpected JWT alg received ...
I am using express-openid-connect:2.8.0 with HS256 signing algorithm: server.js app.use( auth({ authRequired: true, idpLogout: true, ...
Read more >Usage Examples — PyJWT 2.6.0 documentation
Encoding & Decoding Tokens with RS256 (RSA) If you are repeatedly encoding with the same private key, reusing the same RSAPrivateKey also has...
Read more >IDTokenValidator rejects alg=HS256 kid=xxx JWT ... - Bitbucket
The error message that you're getting is indeed symptomatic of trying to do HS256 validation where an RSxxx alg (e.g. RS256) is expected...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, Thanks for sharing that
For the purposes of this SDK, you should use Regular Web Application - which will resolve this issue for you, so closing
But I’ll be sure to follow up with the relevant teams offline to resolve the issue you’ve discovered
@adamjmcgrath This is what I did (Application was already created as SPA with signing algorithm RS256). To change signing algorithm I went to