Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use passport.js and OpenID Connect strategy with Azure AD

I looking to authenticate users using OpenID Connect, Node.js, Passport.js against Azure AD. Could you please point me to any resources/docs and/or sample code?

I came across passport-openidconnect. Is this still the active module? are you aware of any other module that I could use for this? If so if you could point me to some sample code that would be great!

like image 509
genwip Avatar asked Apr 15 '15 13:04

genwip


1 Answers

There is a passport module specifically for Azure AD called passport-azure-ad

The steps to do set this up are:

  1. Register your application (in Azure AD)
  2. Install all the required npm packages.
  3. Setup your app to use the passport-azure-ad.

    3.a Setup the passport strategy

    3.b Add methods to keep track of logged in users

    3.c Initialize passport while loading the express engine

    3.d Add the routes that will handle login/logoff

  4. Use passport to issue sign-in and sign-out requests to Azure AD

Check out the official docs (which include a sample) for code for each of these steps: https://azure.microsoft.com/en-us/documentation/articles/active-directory-devquickstarts-openidconnect-nodejs/

like image 156
Saca Avatar answered Nov 15 '22 17:11

Saca