How to get username in get user script?

Continuing the discussion from Username does not work for login, only email works:

I have two different fields in my database email and username. My api perform get user only through username not by email. How can get username in getuser script ? The documents says it must support username property but how to get it?

Hi @anish.subedi,

Thanks for reaching out to the Auth0 Community!

I understand that you like to know how to get the username in the Get User script in your Custom Database.

It appears that the discussion already has a solution:

Please let me know if you have any trouble with the implementation or need further clarification.

Thanks,
Rueben

Thanks, @ruben.tiow for your prompt response.

Yes, additional logic is necessary to add in the get user script, but how to add that logic, auth0 has given us the template where only email can be used, and replacing and adding username parameter is not working here.
`function getUser(email, callback) {

  // Send user identifier to external database API
  let options = {
    url: "https://example.com/api/search-users",
    body: {
      email: email
    }
  };`

Please please need more details on the implementation

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