Replies: 2 comments
-
Were you able to find out the problem? I'm stuck with this error as well. |
Beta Was this translation helpful? Give feedback.
-
Bumped into the issue and was able to fix it by debugging the library. The issue occurs when the OAuth Profile object returned by Azure AD B2C lacks an Presumably you can modify the scopes that you request so that the B2C endpoint returns an email and prevents this error, but a simpler fix is to insert a custom callback that simply doesn't index for an email, as the argument isn't actually necessary to construct a Here's an example config for constructing AzureADB2CProvider({
tenantId: TENANT_ID,
clientId: CLIENT_ID,
clientSecret: process.env.AZURE_AD_B2C_CLIENT_SECRET!,
primaryUserFlow: process.env.AZURE_AD_B2C_PRIMARY_USER_FLOW,
authorization: {
params: {
scope: `offline_access openid`,
},
},
checks: ['pkce'],
client: {
token_endpoint_auth_method: 'none',
},
profile: (oauthProfile) => ({
id: oauthProfile.sub,
name: oauthProfile.name,
}),
}) |
Beta Was this translation helpful? Give feedback.
-
I am having an issue with integrating an Azure AD B2C provider in my Next.js application. Here are the fields that I have filled out in my [...nextauth].js file:
I have environment variables set in my .env file where. On the Azure portal, I have created an Azure AD B2C directory where I have registered an application. I have my redirect API set to "http://localhost:3000/api/auth/callback/azure-ad-b2c" and I have also created a user flow as well which supports sign-up and sign-in. (I followed these steps listed on the documentation).
I am testing out the user flow of signing up and then signing in, but I am running into an error right after I register for an account. When I click to create a new account, and then register for this account, the account is successfully added to all the users, but an error is thrown and I am redirected to the next-auth login page. The error produced looks like this (I blurred out some of the information):
I am wondering what might be causing this error. I looked online and used ChatGPT, but I have not seen anything like this. Any help would be appreciated and I am willing to also meet virtually.
Beta Was this translation helpful? Give feedback.
All reactions