# Suggesties voor probleemoplossing wanneer Microsoft Auth het verkeerde e-mailadres ophaalt?

**URL:** https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002
**Category:** SSO
**Tags:** 365-oauth
**Created:** [15 juli 2022 om 20:38 UTC](https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002 "2022-07-15T20:38:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![wesochuck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wesochuck/32/108706_2.png) [@wesochuck](https://meta.discourse.org/u/wesochuck)
#### Post date: [15 juli 2022 om 20:38 UTC](https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002/1 "2022-07-15T20:38:38Z")

</div>

We’re using the following plugin from @cpradio for Microsoft Authentication: [Microsoft Authentication](https://meta.discourse.org/t/microsoft-authentication/51731)

We have a user reporting that when they try to login, the system attempts to use their user@_our-tenant_.onmicrosoft.com email address for their account rather than their reply-to/default SMTP address which is: [user@domain.org](mailto:user@domain.org)

We’ve checked and the [user@domain.org](mailto:user@domain.org) is the email address in the Azure AD account and is the primary/reply-to email address in their Exchange online account.

Mostly what I’m wondering is where I should be looking for log files to help troubleshoot what might be going on with this user?

---

<div class="post-metadata">

### Author: ![agungor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/agungor/32/260344_2.png) [@agungor](https://meta.discourse.org/u/agungor)
#### Post date: [15 juli 2022 om 21:03 UTC](https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002/2 "2022-07-15T21:03:13Z")

</div>

My guess is that the plugin is prioritizing the `mail` property of the user resource over `userPrincipalName`. If this is the case, an update to the plugin should resolve the issue.

---

<div class="post-metadata">

### Author: ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)
#### Post date: [15 juli 2022 om 21:16 UTC](https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002/3 "2022-07-15T21:16:34Z")

</div>

It indeed does exactly that! It should be fairly easy to add a setting for this.

```plaintext

info do
        {
          name: raw_info['displayName'] || raw_info['userPrincipalName'],
          email: raw_info['mail'] || raw_info['userPrincipalName']
        }
end

```

---

<div class="post-metadata">

### Author: ![wesochuck](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wesochuck/32/108706_2.png) [@wesochuck](https://meta.discourse.org/u/wesochuck)
#### Post date: [18 juli 2022 om 15:46 UTC](https://meta.discourse.org/t/any-suggestions-for-troubleshooting-when-microsoft-auth-pulls-in-the-wrong-email-address/233002/4 "2022-07-18T15:46:33Z")

</div>

Thanks for this information. You can [use the Graph Explorer](https://developer.microsoft.com/en-us/graph/graph-explorer) to run a query to verify what information this plugin would read from the system.

In our case, we believe that there is some other error going on with the user account that we’d like to remedy rather than attempting to switch to the `userPrincipalName`. Although the account looks good on-prem, the cloud synced account doesn’t look right. We’re behind on our AADConnect version, so we’re updating that to see if it helps.

Thanks again for the help and the pointers!
