User Managment
Sign Up
Let's start integrating the sign-up function from the Email Armor module into your project to provide secure and efficient user onboarding.
Configuration for signUp
function
1. Integration
To start, integrate the signUp
function from the Email Armor module within your API file as shown below:
2. Brief Description of Each Field
Field Name | Description |
---|---|
fullName | Full name of the user |
username | Username provided by the user |
email | Email address of the user |
password | User password (minimum length of 8 characters) |
referralCode | Referral code, or pass an empty string ("" ) if not available |
userAgent | Name of the user's agent (e.g., browser, device, etc.) |
userRole | User role, or pass an empty string ("" ) if none |
3. Error Responses
Status | Message |
---|---|
206 | Min. Password Length Must Be Greater Than 8. |
400 | Invalid Fullname! |
400 | Invalid username! |
400 | Invalid Email! |
400 | Username already exists! |
400 | Email already exists! |
400 | Wrong Referral Code! |
401 | Your device is unauthorized. |
500 | An unexpected error occurred. Please report this issue at GitHub |
4. Success Response
Upon a successful account creation, you'll receive a 202
response along with the following details:
5. Storing Cookies
Once you receive the 202
response, store the id
, userName
, and signedJWTToken
in cookies. Below is an example of how to store these values using Next.js.
Note: You can use any method of cookie storage depending upon your tech stack.
Configuring the signIn
Module
Once the signUp
module is set up, proceed to configure the signIn
module for user authentication and login functionality.