Auth User Lifecycle
Password, email verification, and user profile lifecycle methods.
Endpoints and Methods
auth.forgetPassword()->POST /forget-passwordauth.resetPassword()->POST /reset-passwordauth.resetPassword.token()->GET /reset-password/{token}auth.setPassword()->POST /set-passwordauth.verifyEmail()->GET /verify-emailauth.sendVerificationEmail()->POST /send-verification-emailauth.changeEmail()->POST /change-emailauth.changeEmailVerify()->GET /change-email/verifyauth.deleteUserVerify()->GET /delete-user/verifyauth.changePassword()->POST /change-passwordauth.user.update()->POST /update-userauth.user.delete()->POST /delete-userauth.user.email.list()->GET /email/list(fallback toGET /email-liston404)
Examples
ATHENA_AUTH_BASE_URL="http://localhost:3001/api/auth"
ATHENA_AUTH_TOKEN="<bearer-token>"
# Adjust payload fields using the OpenAPI schema in this page.
# auth.forgetPassword() -> POST /forget-password
curl -X POST "$ATHENA_AUTH_BASE_URL/forget-password" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.resetPassword() -> POST /reset-password
curl -X POST "$ATHENA_AUTH_BASE_URL/reset-password" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.resetPassword.token() -> GET /reset-password/{token}
curl -X GET "$ATHENA_AUTH_BASE_URL/reset-password/sample-value" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN"
# auth.setPassword() -> POST /set-password
curl -X POST "$ATHENA_AUTH_BASE_URL/set-password" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.verifyEmail() -> GET /verify-email
curl -X GET "$ATHENA_AUTH_BASE_URL/verify-email" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN"
# auth.sendVerificationEmail() -> POST /send-verification-email
curl -X POST "$ATHENA_AUTH_BASE_URL/send-verification-email" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.changeEmail() -> POST /change-email
curl -X POST "$ATHENA_AUTH_BASE_URL/change-email" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.changeEmailVerify() -> GET /change-email/verify
curl -X GET "$ATHENA_AUTH_BASE_URL/change-email/verify" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN"
# auth.deleteUserVerify() -> GET /delete-user/verify
curl -X GET "$ATHENA_AUTH_BASE_URL/delete-user/verify" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN"
# auth.changePassword() -> POST /change-password
curl -X POST "$ATHENA_AUTH_BASE_URL/change-password" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.user.update() -> POST /update-user
curl -X POST "$ATHENA_AUTH_BASE_URL/update-user" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.user.delete() -> POST /delete-user
curl -X POST "$ATHENA_AUTH_BASE_URL/delete-user" \
-H "content-type: application/json" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN" \
-d '{"...":"See OpenAPI requestBody schema"}'
# auth.user.email.list() -> GET /email/list
curl -X GET "$ATHENA_AUTH_BASE_URL/email/list" \
-H "authorization: Bearer $ATHENA_AUTH_TOKEN"use reqwest::Client;
use serde_json::json;
let base_url = "http://localhost:3001/api/auth";
let token = "<bearer-token>";
let http = Client::new();
// Adjust payload fields using the OpenAPI schema in this page.
// auth.forgetPassword() -> POST /forget-password
let response = http
.post(format!("{base_url}/forget-password"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.resetPassword() -> POST /reset-password
let response = http
.post(format!("{base_url}/reset-password"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.resetPassword.token() -> GET /reset-password/{token}
let response = http
.get(format!("{base_url}/reset-password/sample-value"))
.bearer_auth(token)
.send()
.await?;
let _ = response.error_for_status()?;
// auth.setPassword() -> POST /set-password
let response = http
.post(format!("{base_url}/set-password"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.verifyEmail() -> GET /verify-email
let response = http
.get(format!("{base_url}/verify-email"))
.bearer_auth(token)
.send()
.await?;
let _ = response.error_for_status()?;
// auth.sendVerificationEmail() -> POST /send-verification-email
let response = http
.post(format!("{base_url}/send-verification-email"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.changeEmail() -> POST /change-email
let response = http
.post(format!("{base_url}/change-email"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.changeEmailVerify() -> GET /change-email/verify
let response = http
.get(format!("{base_url}/change-email/verify"))
.bearer_auth(token)
.send()
.await?;
let _ = response.error_for_status()?;
// auth.deleteUserVerify() -> GET /delete-user/verify
let response = http
.get(format!("{base_url}/delete-user/verify"))
.bearer_auth(token)
.send()
.await?;
let _ = response.error_for_status()?;
// auth.changePassword() -> POST /change-password
let response = http
.post(format!("{base_url}/change-password"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.user.update() -> POST /update-user
let response = http
.post(format!("{base_url}/update-user"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.user.delete() -> POST /delete-user
let response = http
.post(format!("{base_url}/delete-user"))
.bearer_auth(token)
.json(&json!({
"...": "See OpenAPI requestBody schema"
}))
.send()
.await?;
let _ = response.error_for_status()?;
// auth.user.email.list() -> GET /email/list
let response = http
.get(format!("{base_url}/email/list"))
.bearer_auth(token)
.send()
.await?;
let _ = response.error_for_status()?;import { client } from "./auth-client"
await client.auth.forgetPassword({
email: "user@example.com",
redirectTo: "https://app.example.com/reset-password",
})
await client.auth.resetPassword({
newPassword: "new-strong-password",
token: "reset_token",
})
await client.auth.resetPassword.token({
token: "reset_token",
callbackURL: "https://app.example.com/reset-password",
})
await client.auth.setPassword({ newPassword: "new-strong-password" })
await client.auth.verifyEmail({
token: "verify_token",
callbackURL: "https://app.example.com/verified",
})
await client.auth.sendVerificationEmail({
email: "user@example.com",
callbackURL: "https://app.example.com/verify",
})
await client.auth.changeEmail({
newEmail: "new-user@example.com",
callbackURL: "https://app.example.com/change-email",
})
await client.auth.changeEmailVerify({
query: { token: "change_email_token" },
})
await client.auth.deleteUserVerify({
query: { token: "delete_user_token" },
})
await client.auth.changePassword({
currentPassword: "old-password",
newPassword: "new-password",
revokeOtherSessions: true,
})
await client.auth.user.update({
name: "Updated Name",
image: "https://cdn.example.com/avatar.png",
})
await client.auth.user.delete({
password: "current-password",
})
await client.auth.user.email.list()OpenAPI Contract
Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The email address of the user to send a password reset email to
The URL to redirect the user to reset their password. If the token isn't valid or expired, it'll be redirected with a query parameter ?error=INVALID_TOKEN. If the token is valid, it'll be redirected with a query parameter `?token=VALID_TOKEN
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/forget-password" \ -H "Content-Type: application/json" \ -d '{ "email": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new password to set
The token to reset the password
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/reset-password" \ -H "Content-Type: application/json" \ -d '{ "newPassword": "string" }'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
The URL to redirect the user to reset their password
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/reset-password/{token}"{
"token": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
curl -X POST "http://localhost:3001/api/auth/set-password" \ -H "Content-Type: application/json" \ -d '{ "newPassword": "string" }'{
"status": true
}Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
The token to verify the email
The URL to redirect to after email verification
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/verify-email?token=string"{
"user": {
"id": "string",
"email": "string",
"name": "string",
"image": "string",
"emailVerified": true,
"createdAt": "string",
"updatedAt": "string"
},
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The email to send the verification email to
The URL to use for email verification callback
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/send-verification-email" \ -H "Content-Type: application/json" \ -d '{ "email": "user@example.com" }'{
"status": true
}{
"message": "Verification email isn't enabled"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new email to set
The URL to redirect to after email verification
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/change-email" \ -H "Content-Type: application/json" \ -d '{ "newEmail": "string" }'{
"status": true,
"message": "Email updated"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
apiKeyCookie bearerAuth API Key authentication via cookie
In: cookie
Bearer token authentication
In: header
Query Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/change-email/verify?token=string"{
"status": true,
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
apiKeyCookie bearerAuth API Key authentication via cookie
In: cookie
Bearer token authentication
In: header
Query Parameters
Response Body
application/json
curl -X GET "http://localhost:3001/api/auth/delete-user/verify?token=string"{
"status": true,
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The new password to set
The current password
Revoke all other sessions
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/change-password" \ -H "Content-Type: application/json" \ -d '{ "newPassword": "string", "currentPassword": "string" }'{
"token": "string",
"user": {
"id": "string",
"email": "user@example.com",
"name": "string",
"image": "http://example.com",
"emailVerified": true,
"createdAt": "2019-08-24T14:15:22Z",
"updatedAt": "2019-08-24T14:15:22Z"
}
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
The name of the user
The image of the user
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/update-user" \ -H "Content-Type: application/json" \ -d '{}'{
"status": true
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "http://localhost:3001/api/auth/delete-user" \ -H "Content-Type: application/json" \ -d '{}'{
"success": true,
"message": "User deleted"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}Authorization
bearerAuth Bearer token authentication
In: header
Query Parameters
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X GET "http://localhost:3001/api/auth/email/list"{
"total": 0,
"limit": 0,
"offset": 0,
"emails": [
{}
]
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}{
"message": "string"
}