Namespaces
auth
Methods and types of the `auth` namespace (`client.auth` / `bot.auth`).
Interfaces
ChangePasswordData
Properties
DisableMFAData
Properties
LoginCredentials
Properties
LoginRegisterResponse
Properties
RefreshResponse
Extends
AuthTokens
Properties
| Property | Type | Inherited from |
|---|---|---|
access | Token | AuthTokens.access |
refresh | Token | AuthTokens.refresh |
verifyMfa? | Token | AuthTokens.verifyMfa |
RegisterUserData
Extends
Pick<User,"firstName"|"lastName"|"email">
Properties
ResetPasswordData
Properties
VerifyBackupCodeData
Properties
VerifyMFAData
Properties
Functions
default()
function default(client): {
changePassword: Promise<void>;
disableMfa: Promise<void>;
enableMfa: Promise<MFAEnableResponse>;
exchangeOAuthCode: Promise<OAuthExchangeResponse>;
forgotPassword: Promise<void>;
getLinkedOAuthProviders: Promise<LinkedAuthProvider[]>;
linkOAuthProvider: Promise<LoginRegisterResponse>;
lockAccount: Promise<void>;
login: Promise<LoginRegisterResponse>;
logout: Promise<void>;
refreshTokens: Promise<RefreshResponse>;
register: Promise<LoginRegisterResponse>;
registerGuest: Promise<void>;
resendVerification: Promise<void>;
resetPassword: Promise<void>;
sendVerificationEmail: Promise<void>;
setPassword: Promise<void>;
unlinkOAuthProvider: Promise<void>;
upgradeGuest: Promise<{
user: User;
}>;
verifyBackupCode: Promise<MFAVerifyResponse>;
verifyEmail: Promise<void>;
verifyGuest: Promise<LoginRegisterResponse>;
verifyMfa: Promise<MFAVerifyResponse>;
};Defines authentication-related methods for the NuramaClient.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | default | The NuramaClient instance. |
Returns
An object containing the authentication methods.
| Name | Type | Description |
|---|---|---|
changePassword() | ( currentPassword, newPassword, mfaToken? ) => Promise<void> | Changes the authenticated user's password. Requires current password verification and MFA token if MFA is enabled. All refresh tokens will be invalidated after password change. |
disableMfa() | (mfaToken) => Promise<void> | Disables multi-factor authentication for the authenticated user. Requires a current valid MFA token for confirmation. |
enableMfa() | () => Promise<MFAEnableResponse> | Enables multi-factor authentication for the authenticated user. |
exchangeOAuthCode() | (code) => Promise<OAuthExchangeResponse> | - |
forgotPassword() | (email) => Promise<void> | Forgets a user's password. |
getLinkedOAuthProviders() | () => Promise<LinkedAuthProvider[]> | Gets all OAuth providers linked to the authenticated user's account. |
linkOAuthProvider() | (provider) => Promise<LoginRegisterResponse> | Links an OAuth provider to the authenticated user's account. This allows users to sign in with multiple OAuth providers. |
lockAccount() | (token) => Promise<void> | Locks a user account using a lock account token. This is used when a user receives a password changed notification for a change they did not initiate, allowing them to immediately secure their account. |
login() | (credentials) => Promise<LoginRegisterResponse> | Logs in a user. |
logout() | (refreshToken) => Promise<void> | Logs out a user. |
refreshTokens() | (refreshToken?) => Promise<RefreshResponse> | Refreshes user tokens. |
register() | (userData) => Promise<LoginRegisterResponse> | Registers a new user. |
registerGuest() | (data) => Promise<void> | Registers a guest account for public chat participation. Always returns void (204) regardless of outcome for anti-enumeration. |
resendVerification() | (email) => Promise<void> | Public, unauthenticated resend of the verification email keyed by address. For users past the verification grace window who can't log in or call the authed sendVerificationEmail. Always resolves (the server returns 204 regardless of whether the email exists). |
resetPassword() | (params) => Promise<void> | Resets a user's password. |
sendVerificationEmail() | () => Promise<void> | Sends a verification email to the authenticated user. |
setPassword() | (password, mfaToken?) => Promise<void> | Sets a password for an OAuth-only user account. This allows OAuth users to add local authentication as a backup. |
unlinkOAuthProvider() | (provider) => Promise<void> | Unlinks an OAuth provider from the authenticated user's account. User must have at least one authentication method remaining (password or another OAuth provider). |
upgradeGuest() | (data) => Promise<{ user: User; }> | Upgrades a guest account to a standard account with a password. Requires the user to be authenticated as a guest. |
verifyBackupCode() | (backupCode) => Promise<MFAVerifyResponse> | Verifies an MFA backup code. This is used during login when a user has lost access to their authenticator app. |
verifyEmail() | (token) => Promise<void> | Verifies a user's email using the provided token. |
verifyGuest() | (token) => Promise<LoginRegisterResponse> | Verifies a guest account using the token from the verification email. Stores auth tokens on success and returns user data. |
verifyMfa() | (mfaToken) => Promise<MFAVerifyResponse> | Verifies an MFA token (e.g., TOTP code). This is used both during initial MFA setup and during login challenges. |