Unable to Login with the user name for the login page instead of user Email

in one of our tenant we are using custom database in Authentication for our application in that for login page we have written the code for the to login using email or username. when the user uses the email for the login its working fine but when the same user try to go through his user name its showing that invalid email,user,password.

we are using the below query. we are using tedious library in my code

console.log(email,“Email”);
const query = ‘SELECT Id, UserName, Email, PasswordHash FROM dbo.AspNetUsers WHERE Email = @Email or UserName = @Email’;
const query1 = ‘SELECT ClaimType, ClaimValue FROM dbo.AspNetUserClaims WHERE UserId = @UserId and (ClaimType=@Idr or ClaimType=@Idc or ClaimType=@Ecode)’;

we have tried to add the user parameter in the login code and console logs for errors
when we have checked the logs the data for the user is there but the user is still unable to access the application through the username

does any one know why its not working

Hi @yellowblockllp,

I suggest checking your tenant logs to see what is the source of the issue for the failed login.

It might also be worth using the Real-time Webtask Logs Extension to debug your custom database action scripts. You should be able to find clues as to why the login failed with the username and not with email.

Let me know how this goes for you.

Thanks,
Rueben

Hi @rueben.tiow

I verified, No issue on scripts it’s everything fine. but ii gor issue Like " returned profile does not contain specified identifying attribute".

1 Like

Hi, @rueben.tiow
Based on the above information, at script no issue was found. i am getting the issue “returned profile does not contain specified identifying attribute” when i verify login and try on the custom DB function.

1 Like

Hi, @rueben.tiow
Based on the above information, at script no issue was found. i am getting the issue “returned profile does not contain specified identifying attribute” when i verify login and try on the custom DB function.

any update on my issue.

1 Like

Hi @yellowblockllp,

Thanks for your responses.

You might need to review the user profile in the callback URL to include the idr, idc, and ecode properties in the user_metadata or app_metadata if they represent non-identifying attributes.

For example:

callback(null, {
  user_id: user.profile.user_id,
  email: user.profile.email,
  nickname: user.profile.nickname,

  user_metadata: {
    idr: idr,
    idc: idc,
    ecode: ecode
  }
});

Let me know how this goes for you.

Thanks,
Rueben

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.