SignUp
The SignUp
object holds the state of the current sign up and provides helper methods to navigate and complete the sign up flow. Once a sign up is complete, a new user is created.
There are two important steps that need to be done in order for a sign up to be completed:
- Supply all the required fields. The required fields depend on your instance settings.
- Verify contact information. Some of the supplied fields need extra verification. These are the email address and phone number.
The above steps can be split into smaller actions (e.g. you don't have to supply all the required fields at once) and can done in any order. This provides great flexibility and supports even the most complicated sign up flows.
Also, the attributes of the SignUp
object can basically be grouped into three categories:
- Those that contain information regarding the sign-up flow and what is missing in order for the sign-up to complete. For more information on these, check our detailed sign-up flow guide.
- Those that hold the different values that we supply to the sign-up. Examples of these are
username
,emailAddress
,firstName
, etc. - Those that contain references to the created resources once the sign-up is complete, i.e.
createdSessionId
andcreatedUserId
.
Attributes
Name | Type | Description |
---|---|---|
status | string | null | The status of the current sign-up. It can take the following values:
|
requiredFields | string[] | An array of all the required fields that need to be supplied and verified in order for this sign-up to be marked as complete and converted into a user. |
optionalFields | string[] | An array of all the fields that can be supplied to the sign-up, but their absence does not prevent the sign-up from being marked as complete. |
missingFields | string[] | An array of all the fields whose values are not supplied yet but they are mandatory in order for a sign-up to be marked as complete. |
unverifiedFields | string[] | An array of all the fields whose values have been supplied, but they need additional verification in order for them to be accepted. Examples of such fields are emailAddress and phoneNumber . |
verifications | SignUpVerifications | An object that contains information about all the verifications that are in-flight. |
username | string | null | The username supplied to the current sign-up. This attribute is available only if usernames are enabled. Check the available instance settings for more information. |
emailAddress | string | null | The email address supplied to the current sign-up. This attribute is available only if the selected contact information includes email address. Check the available instance settings for more information |
phoneNumber | string | null | The phone number supplied to the current sign-up. This attribute is available only if the selected contact information includes phone number. Check the available instance settings for more information. |
web3Wallet | string | null | The Web3 wallet public address supplied to the current sign-up. In Ethereum, the address is made up of 0x + 40 hexadecimal characters . |
hasPassword | boolean | The value of this attribute is true if a password was supplied to the current sign-up. This attribute is available only if password-based authentication is enabled. Check the available instance settings for more information. |
firstName | string | null | The first name supplied to the current sign-up. This attribute is available only if name is enabled in personal information. Check the available for more information. lastName |
lastName | string | null | The last name supplied to the current sign-up. This attribute is available only if name is enabled in personal information. Check the available instance settings for more information. |
unsafeMetadata | {[string]: any} | null | Metadata that can be read and set from the frontend. Once the sign up is complete, the value of this field will be automatically copied to the newly created user's unsafe metadata. One common use case for this attribute is to use it to implement custom fields that can be collected during sign up and will automatically be attached to the created User object. |
createdSessionId | string | null | The identifier of the newly-created session. This attribute is populated only when the sign-up is complete. |
createdUserId | string | null | The identifier of the newly-created user. This attribute is populated only when the sign-up is complete. |
abandonAt | number | null | The epoch numerical time when the sign-up was abandoned by the user. |
Methods
create()
function create(params: SignUpCreateParams): Promise<SignUpResource>;
This method initiates a new sign-up flow. It creates a new SignUp object and de-activates any existing SignUp that the client might already had in progress.
The form of the given params
depends on the configuration of the instance. Choices on the instance settings affect which options are available to use.
The create
method will return a promise of the new SignUp object. This sign up might be complete if you supply the required fields in one go. However, this is not mandatory. Our sign-up process provides great flexibility and allows users to easily create multi-step sign-up flows.
SignUpCreateParams
Name | Type | Description |
---|---|---|
firstName | string | null | The user's first name. This option is available only if name is selected in personal information. Please check the instance settings for more information. |
lastName | string | null | The user's last name. This option is available only if name is selected in personal information. Please check the instance settings for more information. |
password | string | null | The user's password. This option is available only if password-based authentication is selected. Please check the instance settings for more information. |
birthday | string | null | The user's birthday. This option is available only if birthday is selected in personal information. Please check the instance settings for more information. |
gender | string | null | The user's gender. This option is available only if gender is selected in personal information. Please check the instance settings for more information. |
emailAddress | string | null | The user's email address. This option is available only if email address is selected in contact information. Keep in mind that the email address requires an extra verification process. Please check the instance settings for more information. |
phoneNumber | string | null | The user's phone number. This option is available only if phone number is selected in contact information. Keep in mind that the phone number requires an extra verification process. Please check the instance settings for more information. |
web3Wallet | string | null | The user's Web3 wallet public address. In Ethereum, the address is made up of 0x + 40 hexadecimal characters . |
username | string | null | The user's username. This option is available only if usernames are enabled. Please check the instance settings for more information. |
unsafeMetadata | {[string]: any} | null | Metadata that can be read and set from the frontend. Once the sign up is complete, the value of this field will be automatically copied to the newly created user's unsafe metadata. One common use case for this attribute is to use it to implement custom fields that can be collected during sign up and will automatically be attached to the created User object. |
strategy | OAuthStrategy | SamlStrategy | TicketStrategy | The strategy to use for the sign-up flow. |
redirectUrl | string | The redirect URL after the sign-up flow has completed. |
actionCompleteRedirectUrl | string | The redirect URL after the action has completed for OAuth and SAML sign-up strategies |
transfer | boolean | Transfer the user to a dedicated sign up for an OAuth flow. |
ticket | string | If the strategy is ticket you need to provide the ticket or token generated from the Backend API. |
update()
function update(params: SignUpUpdateParams): Promise<SignUpResource>;
This method is used to update the current sign up.
As with create
, the form of the given params
depends on the configuration of the instance.
SignUpUpdateParams
SignUpUpdateParams
is a mirror of SignUpCreateParams
with the same fields and types.
createMagicLinkFlow()
function createMagicLinkFlow(): { startMagicLinkFlow: (params: StartMagicLinkFlowParams) => Promise<SignUp>; cancelMagicLinkFlow: () => void; };
Sets up a sign up with magic link flow. Calling createMagicLinkFlow()
will return two functions.
The first function is async and starts the magic link flow, preparing a magic link verification. It sends the magic link email and starts polling for verification results. The signature is startMagicLinkFlow({ redirectUrl: string }) => Promise<SignUpResource>
.
The second function can be used to stop polling at any time, allowing for full control of the flow and cleanup. The signature is cancelMagicLinkFlow() => void
.
Returns
createMagicLinkFlow
returns an object with two functions:
Name | Type | Description |
---|---|---|
startMagicLinkFlow | (params: StartMagicLinkFlowParams) => Promise<SignUp> | Function to start the magic link flow. It prepares a magic link verification and polls for the verification result. |
cancelMagicLinkFlow | () => void | Function to cleanup the magic link flow. Stops waiting for verification results. |
StartMagicLinkFlowParams
Name | Type | Description |
---|---|---|
redirectUrl | string | The magic link target URL. Users will be redirected here once they click the magic link from their email. |
Additional methods
In addition to the methods listed above, the SignUp
class also has the following methods: