Nickname is not set to username when signing up

Hi,

I’m working on app with a windows (C# WPF client) and Android (Kotlin, native client) which uses Auth0 for authentication, but I’m getting a really weird behavior from the Auth0 process.
Right now, in term of sign in/up pipeline, what I do is I’m using the WebAuthProvider login form to do the login, and on success, I use the AuthenticationAPIClient to get the user profile of the user containing the username (under the field ‘nickname’) and other useful information.

My problem is the following:
When a new user sign up with a username-password-email account, the nickname I get IS NOT the username of the user, but instead is the first part of his e-mail (before the @).
BUT, when I sign in with an existing user, I get the actual username as the nickname.
This is really weird because I want to store the user’s username in my database when a new user signs up, but I currently can’t find a way to achieve this, other than forcing the user to logout and login again, which is really, really bad.

Can someone enlighten me on what’s going on here, and why I can’t get the username of the newly created user ?

Thank you

I’m experiencing almost the exact same issue right now. My environment is React Native and I’m using Authorization Code Grant Flow with PKCE. Where I am seeing the same behavior is in the response from webAuth.authorize() - the nickname in the idToken is incorrect - it contains the first part of the email (before the @). This only happens right after sign-up. If the user logs out and back in, the nickname is set correctly in the idToken.

Have you been able to find any solutions for this?

Hey!

Sorry I have not found anything. for now I’m using a workaround where after signup I force the user to sign out and re-sign in, but hopefully that’s temporary…

Did you get a solution to this? Although in my case I am using sort-a invite based system. I manually register a user and fill out the username. The auth0 still picks the email-part as the name rather than the username I fill in everytime.

Same doesn’t happen if the user registers themselves via the sign-up pannel in the auth0 auth-login.

still the same issue, signout and signing in doesnt help in my case

I solved this by using a PreUserRegistration flow in the Actions → Flows menu. From there you can choose ‘Pre User Registration’ and create a custom action. Then use the ‘setAppMetadata’ API to change nickname to username. Check the gist below for code specifics.

1 Like

Thanks for sharing that with the rest of community!

1 Like