User Signup Block
User Signup block is used to create API endpoint for signing up users.
NOTE: Signup must be used with POST method.
# How to create a User Signup Block
Drag “User Signup” under “Authentication Blocks” in block picker.
# How to use a User Signup Block
Once your API endpoint is created. Go to your frontend app and send following fields: username, email, password and name. If you don't add any of the following fields endpoint will throw an error. You can opt out of username and name fields by keeping them blank. In case the username field is empty, the email will be used as a username.
{
“username”: “test.username”,
“email”: “test@test.com”,
“password”: “examplepassword”,
“name”: “John Doe”,
}
# Errors
Errors will be sent in JSON form and will have following fields: status, type, message
# Email and username field missing
{
"status": "error",
"type": "email and username field
missing",
"message": "Please send username or
email fields.",
}
Following error will occur if email and username fields are missing in request data.
# Password field missing
{
"status": "error",
"type": "password field missing",
"message": "Please send password
field.",
}
Following error will occur if password field is missing in request data.
# Username and email field empty
{
"status": "error",
"type": "username and email field
empty",
"message": "Please enter username or
email to signup.",
}
Following error will occur if email and username field is empty in request data.
# Password field is empty
{
"status": "error",
"type": "password field is empty",
"message": "Please enter a password.",{" "}
}
Following error will occur if password field is empty in request data.
# Email invalid
{
"status": "error",
"type": "email invalid",
"message": "Email entered is invalid.",{" "}
}
Following error will occur if email field is invalid in request data.
# Email exists
{
"status": "error",
"type": "email exists",
"message": "User with same email exists.
Please enter different email.",
}
Following error will occur if user with given email already exists in database.
# Username exists
{
"status": "error",
"type": "username exists",
"message": "User with same username
exists. Please enter different username.",
}
Following error will occur if user with given username already exists in database.