I want to know the email address of a user to send an email. On my application, people can sign up with social accounts (google/facebook/Microsoft) or local accounts. When creating a local account we use the email.
I found this info about how email is stored. https://learn.microsoft.com/en-us/azure/active-directory-b2c/active-directory-b2c-reference-policies
Email address storage: An email address can be required as part of a user flow. If the user authenticates with a social identity provider, the email address is stored in the otherMails property. If a local account is based on a user name, then the email address is stored in a strong authentication detail property. If a local account is based on an email address, then the email address is stored in the signInNames property. The email address isn't guaranteed to be verified in any of these cases. A tenant administrator can disable email verification in the basic policies for local accounts. Even if email address verification is enabled, addresses aren't verified if they come from a social identity provider and they haven't been changed. Only the otherMails and signInNames properties are exposed through the Active Directory Graph API. The email address in the strong authentication detail property is not available
Not sure why the field "Mail" on the user is not being used... but using GraphApi:
I make a GET: https://graph.microsoft.com/v1.0/Users?$select=displayName,mail,otherMails,signInNames
Some emails appear on "mail", others on the array of "otherMails", and "singInNames" can't be selected :( doesn't show any info, so are some users that I can't get the info about the email.
How can I solve this? Only using Azure AD Graph instead of Microsoft Graph API, since on that API signInNames are returned?
Isn't there any way of storing the emails always on the same property? Or at least one that I have access on Microsoft Graph API? Using Custom policies only with Claims transformation?