auth
and tenants
modules.
This module only exposes endpoints related to the current user (
/api/me
) and does not support administrative actions like creating or managing other users. Creating users would be done by the user via nile.auth.signUp()
, and managing users that are not yourself is not yet support.getSelf
Thenile.users.getSelf()
method retrieves the profile of the currently authenticated user. Internally, this maps to a GET /api/me
request.
This is typically used to display account settings, personalize the UI, or check tenant memberships after a login.
Returns
AUser
object or raw Response
:
updateSelf
Thenile.users.updateSelf()
method allows the currently authenticated user to update their own profile using PUT /api/me
.
Use this to let users edit profile settings like name or profile picture. Fields not included in the update are left unchanged.
Allowed Fields
name
: Full display name of the userfamilyName
: Surname or last namegivenName
: First namepicture
: Optional URL to an avatar or profile imageemailVerified
: The date when the email was verified
The following fields cannot be modified:
email
, tenants
, created
, updated
, or id
.removeSelf
This method deletes the current user’s account by sending aDELETE /api/me
request.
This is a soft delete operation — the user will no longer be able to sign in, but their historical data may still exist in the system for audit purposes. This action also clears all authentication headers that are maintained server-side. It would be necessary remove client side cookies as well for completeness.
Returns
AResponse
object:
200 OK
if the user was successfully marked for deletion401 Unauthorized
if not logged in404 Not Found
if the user does not exist
verifySelf
This method initiates an email verification flow for the current user by POSTing to/auth/verify-email
.
In production, this sends an email containing a link to verify the account, if configured. In development or testing, it can optionally skip the email step and mark the user as verified.
Options
callbackUrl
: Optional. Where to redirect the user after successful verification.bypassEmail
: Optional. Iftrue
, skips the email and setsemailVerified = true
directly.
This bypass is useful for local development and CI environments where SMTP is not configured.
Returns
- If
bypassEmail
is used, resolves to the updatedUser
object. - Otherwise, resolves to a
Response
from the verification endpoint.
Use
nile.auth.signUp()
and nile.auth.signIn()
for authentication, and manage other users through tenant-related APIs where applicable.