Account Activation
Activates an account using the ID received from email.
Usage
Node.js / Next.js
const response = await provider.auth.activate('<activation_id>');Express.js
Requires useProductFlame middleware.
app.get('/activate/:id', async (req, res) => { // Automatically sets the auth cookie const response = await req.auth.activate(req.params.id); res.json(response);});Arguments
| Name | Type | Description |
|---|---|---|
activationId | string | Required. The 24-character ID received in the activation email. |
Response
Type: Promise<{ token: string }>
Returns the session token upon successful activation.
Note: Next.js and Express.js SDKs automatically handle setting the session cookie for you.
Errors
BAD_REQUEST: The activationId is invalid.REQUEST_EXPIRED: The email verification request has expired.UNKNOWN_ERROR: An unknown error has occured.
POST https://api.productflame.com/v1/auth/activation
Request
Headers
{ "Content-Type": "application/json", "Authorization": "<your_secret_api_key>"}Body
{ "activationId": "<activation_id>" // 24 chars fixed length}Response Format
200 OK (Success)
{ "message": "ok"}A Set-Cookie header will also be included to set the session cookie (named at).
400 Bad Request (Validation)
{ "error": "BAD_REQUEST", "message": "The activationId is invalid."}The activation ID provided is not in the correct format (must be 24 characters).
410 Gone
{ "error": "REQUEST_EXPIRED", "message": "The email verification request has expired."}The verification request has expired or the user is already activated.
500 Internal Server Error
{ "error": "UNKNOWN_ERROR", "message": "An unknown error has occured."}An unknown / internal server error occurred.