Request Password Reset
Creates a password reset request, returning an activation id used to fulfil the request.
Usage
Node.js / Next.js / Express.js
const response = await provider.auth.requestPasswordReset('user@example.com', { maxConcurrentRequestsPerEmail: 3, preventEmailSending: false});Arguments
| Name | Type | Description |
|---|---|---|
email | string | Required. The user’s email address. |
options | object | Optional configuration. |
options.maxConcurrentRequestsPerEmail | number | Maximum concurrent requests per email. (Default: 3). |
options.preventEmailSending | boolean | If true, returns the ID immediately without sending email. |
Response
Type: Promise<{ activation: string }>
Returns an object containing the activation ID.
Note: If the user does not exist, the promise resolves successfully (silent failure) to prevent email enumeration, but may not contain an activation ID.
Errors
BAD_REQUEST: One or more body params are invalid.TOO_MANY_REQUESTS: It seems that you send too much requests. Please check your inbox to reset your pasword.UNKNOWN_ERROR: An unknown error has occured.
POST https://api.productflame.com/v1/auth/reset-password
Request
Headers
{ "Content-Type": "application/json", "Authorization": "<your_secret_api_key>"}Body
{ "email": "user@example.com", "maxRequests": 3, "preventEmailSending": false}Response Format
200 OK (Success)
{ "activation": "<activation_id>"}200 OK (User Not Found)
{ "message": "ok"}If the user does not exist, the API returns “ok” to prevent email enumeration.
400 Bad Request (Validation)
{ "error": "BAD_REQUEST", "message": "One or more body params are invalid."}One or more body params are invalid.
429 Too Many Requests
{ "error": "TOO_MANY_REQUESTS", "message": "It seems that you send too much requests. Please check your inbox to reset your pasword."}It seems that you send too much requests. Please check your inbox to reset your pasword.
500 Internal Server Error
{ "error": "UNKNOWN_ERROR", "message": "An unknown error has occured."}An unknown error has occured.