curl --request POST \
--url https://api.example.com/api/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"message": "Please provide username, email and password"
}
Register a new user account
curl --request POST \
--url https://api.example.com/api/auth/register \
--header 'Content-Type: application/json' \
--data '
{
"username": "<string>",
"email": "<string>",
"password": "<string>"
}
'{
"message": "Please provide username, email and password"
}
{
"message": "User registered successfully",
"user": {
"id": "507f1f77bcf86cd799439011",
"username": "johndoe",
"email": "[email protected]"
}
}
token with a 1-day expiration. The token contains:
id: User’s unique identifierusername: User’s usernameexp: Token expiration timestamp{
"message": "Please provide username, email and password"
}
curl -X POST https://api.example.com/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "johndoe",
"email": "[email protected]",
"password": "securePassword123"
}'
JWT_SECRET environment variable