title: login to azure AD with nextauth
body: <p>I'm trying to config login with azure AD using nextauth.
  It is working in localhost but in build or in production it doesn’t work.</p>
  <p>the error I'm getting is shown below.</p>
  <p><a href="https://i.stack.imgur.com/1EwOl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1EwOl.png" alt="enter image description here" /></a></p>
  <p>this is the custom provider:</p>
  <pre><code>providers: [
  {
    id: &quot;msal&quot;,
    name: &quot;Microsoft Login&quot;,
    type: &quot;oauth&quot;,
    version: &quot;2.0&quot;,
    scope: &quot;https://graph.microsoft.com/user.read&quot;,
    params: { grant_type: &quot;authorization_code&quot; },
    accessTokenUrl: process.env.MSAL_TOKEN_ACCESS,
    requestTokenUrl: process.env.MSAL_TOKEN_REQUEST,
    authorizationUrl: process.env.MSAL_TOKEN_AUTHORIZE,
    profileUrl: &quot;https://graph.microsoft.com/oidc/userinfo&quot;,
    profile: (profile) =&gt; {
      // 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,
  },
  ],
  </code></pre>