Ask for more at sign-up with profile fields
Collect a username, name, user type or custom details at sign-up, checked on the server and saved with the user's profile.
By default, sign-up asks for an email and, if you use passwords, a password. Sign-up fields let you ask for more, such as a username, a name, a user type or an organization. Each value is checked on the server, so your own form cannot skip the rules, and it is saved with the user's profile under the field's key.
Add fields
- Open Authentication > Settings > Sign-up fields.
- Under Add:, choose a ready-made field: Username, First name, Last name, User type or Organization. Or choose Custom field.
- Adjust the field (see below).
- Choose Save changes.
Existing users are not changed by new fields.
What you can set on a field
- Label: what the user sees, for example "Username".
- Key (saved as): the name the value is stored under in the profile, for example
username. - Type: Short text, Long text, Number, Yes / no or Choice.
- Limits depending on the type: Shortest and Longest for text, Lowest and Highest for numbers, and Choices (one per line) for a choice.
- Hint (optional): shown under the field.
- Flags such as required, unique and whether the user can edit the value later. The ready-made Username field is required, unique, and 3 to 30 characters. User type is a required choice (
customeroradmin) that cannot be edited afterwards.
Note: A "user type" field that offers
adminis only a label stored on the profile. Never use a value a user typed at sign-up to decide who gets special rights. Grant powers on your server, or with a field the user cannot edit.
Use it in your app
Your app sends the values as metadata when it signs a user up:
await pgb.auth.signUp({
email, password,
metadata: { username: "alex", user_type: "customer" },
});
Your sign-up form can read the list of fields from the project's settings (getSettings()) and draw itself from it. Later, updateUser({ metadata: { name: "Alex" } }) changes values the user is allowed to edit, and a null removes a key.
Test it
In Auth Playground use Sign up, then open the user in Authentication > Manage to see the saved profile.
Good to know
- Values that fail a rule are refused with a message that names the field.
- Profile values are stored with the user and returned by the user calls. Do not store secrets in them.
More guides in Console: authentication
Authentication in your project: users, settings and the Playground
What built-in authentication gives your app, and a tour of the Authentication page in the Console.
Choose sign-in methods and password rules
Turn sign-in methods on or off, set password rules and session lifetimes, and decide whether email must be verified.
Email verification and password reset
How confirmation emails and password resets work, and how to wire the links into your app.
Customize the emails your users receive
Edit the subject, wording, sender name and button colour of sign-in, verification and reset emails, with a live preview.
Send authentication emails from your own domain
Add and verify a sending domain so sign-in, verification and reset emails show your brand and address.
Add social login with Google or GitHub
Register your app with a provider, paste its credentials into the Console, and let people sign in with an account they already have.