
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
validate-azure-ad-token
Advanced tools
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.
This is a function that can be used to validate an access token received from Azure Active Directory. It is particularly useful when you're using a MSAL library to authenticate users on the frontend and you want to verify Microsoft tokens in the API.
For more information about the required props to validate your token and the library itself, please refer to the API Documentation
yarn add validate-azure-ad-token
npm install validate-azure-ad-token
https://login.microsoftonline.com/{tenantId}/discovery/keys?appid={applicationId}
to receive all public keys unique to your applicationId
and tenantId
. This action is cached after one successful attempt.aud
, tid
,iss
,scp
, appid
, exp
.const validate = require('validate-azure-ad-token').default;
try {
const decodedToken = await validate('YOUR_MICROSOFT_ACCESS_TOKEN', {
tenantId: 'YOUR_TENANT_ID',
audience: 'YOUR_AUDIENCE_ID',
applicationId: 'YOUR_APPLICATION_ID',
scopes: 'YOUR_SCOPES', // for example ["User.Read"]
});
// DO WHATEVER YOU WANT WITH YOUR DECODED TOKEN
} catch (error) {
// ALL ERRORS GONNA SHOW HERE AS A STRING VALUE
}
If you are using a @azure/msal-react or @azure/msal-browser on the frontend site and you want to verify your Microsoft access token on your node server.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
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.
The npm package validate-azure-ad-token receives a total of 1,430 weekly downloads. As such, validate-azure-ad-token popularity was classified as popular.
We found that validate-azure-ad-token demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.