I added the following code to add the user principal name to the information retrieved from Entra ID.
async profile(profile) {
const newProfile = {
...profile,
// throws error without this - unsure of the root cause (https://stackoverflow.com/questions/76244244/profile-id-is-missing-in-google-oauth-profile-response-nextauth)
id: profile.sub,
isAdmin: adminEmails?.includes(profile.email?.toLowerCase()) || adminEmails?.includes(profile.preferred_username?.toLowerCase()),
preferred_username: profile.preferred_username //Add
}
return newProfile;
}
However, the user information retrieved from session did not include the user principal name.
I am wondering if something has to be done in the process of getting the profile and then setting the value in the session, but I can't figure out where.
*For example, changing types.ts.
I added the following code to add the user principal name to the information retrieved from Entra ID.
However, the user information retrieved from session did not include the user principal name.
I am wondering if something has to be done in the process of getting the profile and then setting the value in the session, but I can't figure out where. *For example, changing types.ts.
Does anyone know where it is?
Best regards.