client.auth. When you call login() or refreshToken(), the module stores the accessToken and uses it for subsequent authenticated requests such as me() or updateProfile().
signUp
Create a new user account.
login
Authenticate an existing user. The returned accessToken is stored internally.
AuthResponse
refreshToken
Rotate the current access token.
- Browser: Call without arguments. It will automatically use the
refreshTokenstored in your HTTP-only cookies. - Mobile/Node: Pass the
refreshTokenstring manually.
me
Fetch the profile of the currently authenticated user.
updateProfile
Update the authenticated user’s profile fields.
changePassword
Change the authenticated user’s password.
Social auth
urBackend supports OAuth via GitHub and Google.socialStart
You receive a URL to initiate the OAuth flow. Redirect your user’s browser to this URL.
socialExchange
Exchange the rtCode received at your callback URL for a refresh token.
Account verification
Use these methods to handle email OTP flows.| Method | Description |
|---|---|
verifyEmail(payload) | Verify an account using the OTP sent to email. |
resendVerificationOtp(payload) | Request a new verification OTP. |
requestPasswordReset(payload) | Start the “forgot password” flow. |
resetPassword(payload) | Complete password reset using an OTP. |
publicProfile
Fetch a public-safe profile for any user by their username. This does not return sensitive fields like email or provider IDs.
logout
Call this to revoke your current session on the server and clear the local token.
Manual token management
If you need to manage tokens manually (for example, after social auth), you can use these helper methods:getToken(): Returns the current in-memory access token.setToken(token): Manually set the access token for the client.
