1

我正在尝试使用 nextauth 使用 azure AD 配置登录。它在本地主机中工作,但在构建或生产中它不起作用。

我得到的错误如下所示。

在此处输入图像描述

这是自定义提供程序:

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) => {
    // console.log(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,
},
],
4

0 回答 0