简体   繁体   中英

Authentication for Azure Active Directory using adal for node.js application

I am trying to authenticate users through Azure Active Directory in a node.js application. I am using azure-activedirectory-library-for-nodejs. Here is the sample code I have replicated https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/sample/username-password-sample.js . I have created a self signed certificate and uploaded to Azure AD using Azure AD power shell. I am still getting certificate un-trsuted error. Can anyone suggest a solution for the issue?

The sample code ( https://github.com/AzureAD/azure-activedirectory-library-for-nodejs/blob/master/sample/username-password-sample.js ) don't need to use any self signed certificate to authenticate user.

Generally, Using management certificate to authentificate for Service Management on Azure, please refer to https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx .

The easy way to authenticate users for sign-in nodejs app is using "passport-azure-ad" package, you can refer to https://azure.microsoft.com/en-us/documentation/articles/active-directory-v2-devquickstarts-node-web/ . And there is a sample https://github.com/Azure-Samples/active-directory-node-webapp-openidconnect for this scenario.

The passport-azure-ad is a strategy of passportjs for Azure AD OpenID connect.

If you just want to authenticate users for using AAD to sign-in apps, you can also try to use passport-azure-ad-oauth2 https://github.com/auth0/passport-azure-ad-oauth2 .

About the usage of PassportJS , please refer to http://passportjs.org/docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM