question

PalaniGanesh-1728 avatar image
0 Votes"
PalaniGanesh-1728 asked ·

Exception AADSTS50034: The user account {EmailHidden} does not exist

We are trying to authenticate the users for our Web App & Mobile App using Azure Active Directory via MS Graph API. We are created users and given required access rights for the app. Even for the admin user, we are getting the exception AADSTS50034: The user account {EmailHidden} does not exist in the ab6d6a8a-83ea-4650-a631-5cb43442842b directory.
To sign into this application, the account must be added to the directory.\r\nTrace ID: 68d6f664-6d50-4c1f-9ae8-42f3aa497c00\r\n
Correlation ID: 3d30e47d-b2ac-42cd-bfd5-069dbd8f5c67\r\nTimestamp: 2021-02-08 13:56:51Z"}

.net code to authenticate the username and password is


public async Task<string> GetValidAD(JObject jsonResult)
{
try
{
var scopes = new string[] { "https://graph.microsoft.com/.default" };
dynamic Item = JObject.Parse(jsonResult.ToString());
String clientId = Item.clientId.ToString();
String tenantID = Item.tenantID.ToString();
String email = Item.email.ToString();
String password = Item.password.ToString();
System.Security.SecureString pword = new NetworkCredential(email,password).SecurePassword;
string pwordstr = new NetworkCredential(email, pword).Password;

             IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
             .Create(clientId)
             .WithTenantId(tenantID)
             .Build();

             try
             {
                 var result = await publicClientApplication.AcquireTokenByUsernamePassword(scopes, email, pword).ExecuteAsync();
                 return result.ToString();
             }
             catch (MsalUiRequiredException ex)
             {
                 return ex.InnerException.ToString();
                 // error handling omited here (see sample for details)
             }
         }
         catch (Exception ex)
         {
             return ex.ToString();
         }
     }

Please help me to resolve the issue. Thanks in advance

azure-active-directoryazure-ad-graphazure-ad-app-developmentazure-ad-access-reviews
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MarileeTurscak avatar image
0 Votes"
MarileeTurscak answered ·

Hi @PalaniGanesh-1728,

You mentioned that you are getting this error when logging in with the email address. In Azure AD a user is normally authenticated by the User Principal Name (UPN) and not the email address. Most times it will let you use the form of smtp:username@tenant.onmicrosoft.com to log in. Also, if your company domain has not been registered as a verified domain within your Azure AD tenant you will get an "invalid user name or password error."

My guess is if you are using an email address that would be your issue and I would check to see if you could log in using the UPN instead.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@PalaniGanesh-1728

I just wanted to check in and see if you had any other questions or if you were able to resolve this issue?

If you have any other questions, please let me know.
Thank you for your time and patience throughout this issue.


Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

0 Votes 0 ·