microsoft / azurechat

🤖 💼 Azure Chat Solution Accelerator powered by Azure Open AI Service
MIT License
1.15k stars 958 forks source link

I want to get user principal name from Entra ID. #294

Closed yuukitakahashi-ava closed 2 months ago

yuukitakahashi-ava commented 5 months ago

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.

Does anyone know where it is?

Best regards.

yuukitakahashi-ava commented 2 months ago

This case is closed.