NextAuth配置Azure AD登录:本地环境正常但生产构建环境运行失效
问题场景
使用 NextAuth 配置 Azure AD 登录功能,本地 localhost 开发环境下可正常使用,生产构建部署到线上环境后功能失效,运行时返回的报错信息如下:
当前自定义登录提供者配置
providers: [ { id: "msal", name: "Microsoft Login", type: "oauth", version: "2.0", scope: "https://graph.microsoft.com/user.read", params: { grant_type: "authorization_code" }, accessTokenUrl: process.env.MSAL_TOKEN_ACCESS, requestTokenUrl: process.env.MSAL_TOKEN_REQUEST, authorizationUrl: process.env.MSAL_TOKEN_AUTHORIZE, profileUrl: "https://graph.microsoft.com/oidc/userinfo", profile: (profile) => { return { id: profile.sub, name: profile.name, last_name: profile.family_name, first_name: profile.given_name, email: profile.email, }; }, clientId: process.env.MS_CLIENT_ID, clientSecret: process.env.MS_CLIENT_SECRET, }, ],
内容的提问来源于stack exchange,提问作者Avner Russler
相关产品推荐
相关产品推荐

