Azure AD Verify Token
Verify JWT issued by Azure Active Directory B2C.
Table of Contents
Features
- 🎉 Verify JWT issued by Azure Active Directory B2C.
- 🚀 Automatically use the rotated public keys from Azure.
- 💪 Written in TypeScript.
Installation
npm install azure-ad-verify-token --save
Usage
import * as advt from 'azure-ad-verify-token';
const config = {
jwksUri: 'https://contoso.b2clogin.com/contoso.onmicrosoft.com/discovery/v2.0/keys?p=b2c_1_signupsignin1',
issuer: 'https://contoso.b2clogin.com/3285c484-dce5-4abb-a341-bbe4f2bc8554/v2.0/',
audience: '99d1275c-e805-483f-b832-600f8130829c'
};
advt
.verify(token, config)
.then(decoded => {
console.log(decoded);
})
.catch(error => {
console.error(decoded);
});
Configuration options:
Property | Type | Description |
---|
jwksUri | string | jwk_uri value obtained from B2C policy metadata endpoint. |
issuer | string | issuer value obtained from B2C policy metadata endpoint. |
audience | string | Client ID of the application accessing the tenant. |
B2C policy metadata endpoint example:
https://contoso.b2clogin.com/contoso.onmicrosoft.com/v2.0/.well-known/openid-configuration?p=b2c_1_signupsignin1
References
Development
npm install
npm run build