azure-jwt-verify

Verify JWT Token issued by Azure Active Directory B2C

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
azure-jwt-verify
17111.0.06 years ago6 years agoMinified + gzip package size for azure-jwt-verify in KB

Readme

azure-jwt-verify ================================= npm version license

This Plugin Requires

  • NodeJS Runtime

Features

  • Verify JWT Token issued by Azure Active Directory B2C
  • Automatically use the rotated public key from Azure Public Keys URL

Install Plugin

npm install --save azure-jwt-verify

Using Azure JWT Verify in your code

You need to define the following constants based on your Azure Active Directory B2C application configurations

Initialize module

```javascript var azureJWT = requre('azure-jwt-verify'); ```

Configuration and the JWT to verify

```javascript var jwtToken = "YOURJWTTOKENTOVERIFY"; // You can find this url in Azure Active Directory B2C Section const config = {
JWK_URI: "",
ISS: "",
AUD: ""
}; ```
  • JWKURI and the ISS(Issuer) can be obtained from the metadata endpoint of the policies created in the B2C tenant.
  • AUD(Audience) is the Client ID of the application accessing the tenant.

Verify Function

```javascript azureJWT.verify(jwtToken, config).then(function(decoded){ // success callback }, function(error){ // error callback }) ```

Links

License

MIT