I have enabled usernames in my Database Connection, and the username field shows up for new user sign-ins. But after they sign in, when I try to access the username field using the user object from useAuth0(), I get undefined. There is a nickname field, but it isn’t set to the username either. How can I access the username that the user signed up with?
Please verify where you have defined username field. Most probably it shold be in user_metada tag and you need to access it using user.user_metadata.username. In this way you will get your username.
Please let us know if it helps.
I am using
createAuth0Client(initOptions).getUser() to get the user object, as shown in the React tutorial: https://auth0.com/docs/quickstart/spa/react/01-login. I haven’t defined username anywhere myself, other than turning it on my my Database Connection.
If i am getting you correct you migrating users from third party database/system to auth0. Right?
No, I am not using a third-party db, I just want to use a user’s username in my frontend app and I’m unable to get it
Any update? I have the same issue. I am using useAuth0 hook in a React app to get user info. user object returned by useAuth0 has nickname field but not username. How can I get the username?