gpt4 book ai didi

passport.js - Passport - Azure AD - 此 API 版本不支持应用程序

转载 作者:行者123 更新时间:2023-12-01 05:00:02 32 4
gpt4 key购买 nike

当我使用 NPM 包“passport-azure-ad”尝试连接到 Azure AD 时,出现以下错误。我已成功连接到 Facebook、Google 和 MSFT Live,成功,但无法弄清楚为什么 Azure AD 不喜欢我的配置。

这个错误是什么意思???

错误:

Application xxx is not supported for this API version.

我看过不少文章和 GitHub 存储库,但每篇都略有不同,并没有说明需要哪些选项。

https://github.com/AzureADQuickStarts/B2C-WebApi-Nodejs/blob/master/node-server/app.js
https://github.com/Azure-Samples/active-directory-node-webapp-openidconnect/blob/master/app.js

这是我的配置:
var OIDCStrategy = require('passport-azure-ad').OIDCStrategy;

var WINDOWS_AD_CLIENT_ID = "xxxx"
var WINDOWS_AD_CLIENT_SECRET = "xxxx"

passport.use(new OIDCStrategy({
callbackURL: "/dealer/auth/azuread/callback"
, realm: 'xxxxx' //tenant Id
, clientID: WINDOWS_AD_CLIENT_ID
, clientSecret: WINDOWS_AD_CLIENT_SECRET
, identityMetadata: 'https://login.microsoftonline.com/common/.well-known/openid-configuration'
//, tenantName: 'xxxx.onmicrosoft.com'
//, policyName: 'B2C_1_DealerSignin'
//, validateIssuer: true
//, audience: 'http://localhost:3000/dealer'
//oidcIssuer: config.creds.issuer,
, skipUserProfile: true // for AzureAD should be set to true.
, responseType: 'id_token' // for login only flows use id_token. For accessing resources use `id_token code`
, responseMode: 'form_post' // For login only flows we should have token passed back to us in a POST
//scope: ['email', 'profile'] // additional scopes you may wish to pass
},
function(iss, sub, profile, accessToken, refreshToken, done) {
console.log("Windows AD Profile retrieved")
return done(null, profile);
}
));

和路线:
router.get('/auth/azuread',
passport.authenticate('azuread-openidconnect', { scope: 'email profile' }),
function(){
console.log("Azure AD endpoint invoked.")
});

router.post('/auth/azuread/callback',
function(req, res, next) {
console.log("Azure AD Auth callback is invoked")
next()
},
passport.authenticate('azuread-openidconnect'),
function(req, res) {
console.log("Azure AD Auth callback is finished")
res.redirect('/dealer');
}
);

最佳答案

每当我在以下位置创建应用程序时,我都会遇到同样的问题:

Portal.Azure.com -> Azure AD -> App Registrations

或经典门户上的等效内容。

我必须在以下位置创建我的应用程序:
apps.dev.microsoft.com

让它工作。希望这对其他人有帮助。

关于passport.js - Passport - Azure AD - 此 API 版本不支持应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33877092/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com