Skip to content

Register

Create a new account with an email and a password.

Usage

Node.js / Next.js

const response = await provider.auth.register('[email protected]', 'password123');

Express.js Requires useProductFlame middleware.

app.post('/signup', async (req, res) => {
// Automatically sets the auth cookie
const response = await req.auth.register('[email protected]', 'password123');
res.json(response);
});

Arguments

NameTypeDescription
emailstringRequired. The user’s email address.
passwordstringRequired. Must be at least 6 characters.
optionsobjectOptional configuration (currently empty).

Response

Type: Promise<{ token: string }>

  • If Email Verification is Disabled: Returns the session token immediately.
  • If Email Verification is Enabled: Sends an activation email. The token field 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.