Giter Site home page Giter Site logo

playerony / validate-azure-ad-token Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 8.0 1.39 MB

Function to validate access token received from azure active directory. Useful when you're using a msal library to authenticate users on the frontend and you wanna verify Microsoft tokens in the API.

Home Page: https://playerony.github.io/validate-azure-ad-token

License: MIT License

Shell 15.65% JavaScript 25.37% TypeScript 58.98%
msal token azure-functions azure msal-library msal-react msal-browser graph-api microsoft validation jsonwebtoken axios azure-ad-jwt identity

validate-azure-ad-token's Issues

validate-token-with-graph-api fails because the audience id of our web api is not the audience id auf Graph API

await validateTokenWithGraphApi(accessToken, decodedAccessToken.payload);

This line produces "Access token validation failure. Invalid audience."
For me, this is clear. The audience id in our jwt tokens is the application id of our custom web api.
Graph API declines jwt tokens that are not issued for Graph API.
Why at all validate against graph api?

validate-token-header - does it really validate?

Hi,

I was just looking at the code for validate-token-header.ts and I am confused by what it does. It seems all validate-token-header is doing is getting a public key corresponding to the tokenHeader.kid property. After that it does not really validate the token using the public key. Is that correct?

const isValidPublicKey = data.keys.some((_key) => _key.kid === tokenHeader.kid); if (!isValidPublicKey) { throw new Error('The public key retrieved from the token header is invalid'); }

Thanks,
Sanjoy

Update Axios version

can you please update the Axios version, synk is noticing a security issue with the current version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.