Authentication ADRE ADUE using Node.js Passport return 'not supported for this version of the API'

I am currently developing an application that uses Azure AD for authentication. The application must support multiple tenants, however, only an authorized list of tenants must have access to the application. Using the passport-azure-ad library, I added the OIDCStrategy passport as follows:

 // Use Azure AD OAuth2 strategy. passport.use('strategyName', new OIDCStrategy({ callbackURL: 'http://localhost:8080/oauth2/strategyName/callback', clientID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', clientSecret: 'secret', identityMetadata: 'https://login.microsoftonline.com/test.mydomain.com/v2.0/.well-known/openid-configuration', responseType: 'id_token', responseMode: 'form_post', skipUserProfile: true }, function (iss, sub, profile, accessToken, refreshToken, done) { console.log(profile); done(); })); 

In my routes, I have the following setting:

 // Authentication endpoint. router.get('/strategyName', app.passport.authenticate('strategyName')); router.post('/strategyName/callback', function (req, res, next) { app.passport.authenticate('strategyName', function (err, account) { console.log(err); console.log(account); next(err); })(req, res, next); } ); 

When I visit http://localhost:8080/oauth2/strategyName , I am redirected correctly to the Microsoft login page. However, after authentication, I get this message in the console:

 { "name": "Microsoft OIDC Passport Strategy", "hostname": "611b0a5198dd", "pid": 60, "level": 30, "msg": "Body received was: { error: 'unauthorized_client',\n error_description: 'AADSTS70001: Application \\'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\\' is not supported for this API version.\\r\\nTrace ID: c8f56153-1125-44ac-af12-55f69b421d36\\r\\nCorrelation ID: d20580ba-75d4-47b9-9497-6a6b02cd72a7\\r\\nTimestamp: 2015-10-20 09:00:15Z' }", "time": "2015-10-20T09:00:16.266Z", "v": 0 } 

I have a directory called test.mydomain.com added to the Azure management portal, and the application is also added.

Azure screenshots

+6
source share

All Articles