Register
Create a new account with an email and a password.
Usage
Node.js / Next.js
Express.js
Requires useProductFlame middleware.
app.post('/signup', async (req, res) => { // Automatically sets the auth cookie res.json(response);});Arguments
| Name | Type | Description |
|---|---|---|
email | string | Required. The user’s email address. |
password | string | Required. Must be at least 6 characters. |
options | object | Optional configuration (currently empty). |
Response
Type: Promise<{ token: string }>
- If Email Verification is Disabled: Returns the session
tokenimmediately. - If Email Verification is Enabled: Sends an activation email. The
tokenfield may be missing or empty until activation.
Note: Next.js and Express.js SDKs automatically handle setting the session cookie for you.
Errors
INVALID_CREDENTIALS: The email is invalid.INVALID_CREDENTIALS: The password is invalid or the user doesn’t exist.USER_ALREADY_EXISTS: An account with this email adress already exists. Please log in using it.PROVIDER_NOT_CONFIGURED: The local provider is not enabled.TOO_MANY_REQUESTS: It seems that you sent too many requests. Please check your inbox to validate your account.
Request
Headers
{ "Content-Type": "application/json", "Authorization": "<your_secret_api_key>"}Body
{ "password": "secretpassword"}Response Format
200 OK (Success)
{ "message": "ok" // Only if verification disabled}A Set-Cookie header will also be included to set the session cookie (named at).
400 Bad Request (Validation)
{ "error": "INVALID_CREDENTIALS", "message": "The email is invalid." // OR: "The password is invalid or the user doesn't exist."}The email is invalid or the password is invalid / too short (< 6 chars).
409 Conflict
{ "error": "USER_ALREADY_EXISTS", "message": "An account with this email adress already exists. Please log in using it."}An account with this email address already exists.
418 I’m a Teapot (Config Error)
{ "error": "PROVIDER_NOT_CONFIGURED", "message": "The local provider is not enabled."}The ‘local’ provider is not enabled in the project.
429 Too Many Requests
{ "error": "TOO_MANY_REQUESTS", "message": "It seems that you sent too many requests. Please check your inbox to validate your account."}Rate limit (3 emails / day) exceeded for registration emails. (only applies if email verification is enabled)
500 Internal Server Error
{ "error": "UNKNOWN_ERROR", "message": "An internal server error occurred."}An unknown / internal server error occurred.