Are there any examples of validating a JWT on node.js and express? Skip to main content
https://support.okta.com/help/answers?id=9062a000000xzmlqaw&refurl=http%3a%2f%2fsupport.okta.com%2fhelp%2fanswers
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
1
2
3
4
5
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Martin PainMartin Pain 

Are there any examples of validating a JWT on node.js and express?

I'm trying to use Okta's OpenID Connect feature to generate an id_token in a web app, which then gets passed to my REST endpoints to authorise the user.

I've tried using the https://github.com/auth0/express-jwt Express middleware, but this doesn't seem to work with JWK and key rotation which Okta's OpenID Connect feature uses (see my issue on that project: https://github.com/auth0/express-jwt/issues/166 ).

I've also found https://devstufftoremember.wordpress.com/2017/04/12/verify-jwt-access_token-jsw-using-jwk-and-node-js/ that uses the node-jose package to verify a JWT token using JWK keys. I can't find any middleware for that, so I might try writing my own.

Are there any examples of how to do this in Node?
BehrouzBehrouz (Okta, Inc.) 
Good morning Martin,
Here are some articles that might be helpful:
- https://github.com/auth0/node-jwks-rsa/tree/master/examples/express-demo
- http://stackoverflow.com/questions/32634817/express-js-node-js-okta-getting-user-and-groups-info

And also here is our developer article regarding Okta OpenID Connect:
https://help.okta.com/en/prev/Content/Topics/Apps/Apps_App_Integration_Wizard.htm#OIDCWizard

If you still have questions or issues, I would recommend you to visit our developer's support page here : https://developer.okta.com/ you also can send your questions to developers@okta.com which will automatically create a ticket with our developers.

Thank you,
Behrouz Ghorchi
Technical Support Engineer
Okta Global Customer Care
BehrouzBehrouz (Okta, Inc.) 
Also now we have Middleware for express:
https://github.com/okta/okta-oidc-js/tree/master/packages/oidc-middleware

Thank you,
Behrouz Ghorchi
Technical Support Engineer
Okta Global Customer Care