Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including azure-authenticate-express-middleware with all npm packages installed. Try it out:

var azureAuthenticateExpressMiddleware = require("azure-authenticate-express-middleware")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

azure-authenticate-express-middleware v1.1.1

Express middleware to authenticate request with Azure AD

azure-autheniticate-express-middleware

An express middleware to verify that the token supplied with a request is from an authorised Azure AD user.

usage

const express = require('express');
const app = express();

const azureAuthenticateMiddleware = require('azure-authenticate-express-middleware');
const config = {
  tenantId: '4555f184-f629-4962-a914-2720ccc49c5a'
  clientId: 'd1348fb9-1ce4-4a1d-bc17-c752863e346b'
}

app.use(azureAuthenticateMiddleware(config));

The next piece of middleware excutes if you're token is valid. All other circumstances will return a 401.

  • the tenantId is used to validate the issuer
  • the clientId is used to validate the audience
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free