Home > other >  OAuth 2.0 authorization how to validate token from vanilla JavaScript?
OAuth 2.0 authorization how to validate token from vanilla JavaScript?

Time:06-24

I m using auth 2.0 CODE flow in my application. I m able to success fully creating token with oauth2.0 . I m using Microsoft auth 2.0 with active directory.

I don't want use MSAL.js I want to create my own vanilla JS where i can call some api end point and verify token.

i dont want to use any library any thoughts

CodePudding user response:

Azure AD does not offer a token verification endpoint, each app verifies the tokens they receive. You can use generic JWT validation libraries to validate tokens typically. MSAL is only used to acquire tokens, not validate them.

CodePudding user response:

You can implement your own JWT validation solution but, unless you want to re-create the wheel, you will have to use some libraries.

Take a look to jsonwebtoken verify and jws VerifyStream so you can estimate the degree of effort required.

And take a look to Validating Azure Active Directory (AD) generated OAuth tokens.

Hope that helps!

  • Related