Skip to content

ESPRMAuth

Defined in: src/ESPRMAuth.ts:11

Shell class for authentication operations. Methods are added via prototype augmentation in methods/ESPRMAuth/*.

new ESPRMAuth(): ESPRMAuth

ESPRMAuth

changePassword(oldPassword, newPassword): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/ChangePassword.ts:23

Change the password for the currently authenticated user.

string

The current password

string

The new password

Promise<ESPAPISuccessResponse>

Success response confirming the password was changed


confirmForgotPassword(username, password, verificationCode): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/ForgotPassword.ts:34

Complete the forgot-password flow with a new password and verification code.

string

The user’s email or username

string

The new password

string

The code received via email

Promise<ESPAPISuccessResponse>

Success response confirming the password was reset


confirmSignUp(username, verificationCode, tags?): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/ConfirmSignUp.ts:24

Confirm a new user registration with the verification code.

string

The email or username that was registered

string

The code received via email

string[]

Optional tags to associate with the new user

Promise<ESPAPISuccessResponse>

Success response confirming the sign-up


forgotPassword(username): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/ForgotPassword.ts:25

Initiate the forgot-password flow. Sends a verification code to the user.

string

The user’s email or username

Promise<ESPAPISuccessResponse>

Success response confirming the code was sent


getLoggedInUser(): Promise<ESPRMUser | null>

Defined in: src/methods/ESPRMAuth/GetLoggedInUser.ts:24

Restore an existing session from stored tokens. Returns null if no valid session exists. Automatically refreshes expired access tokens.

Promise<ESPRMUser | null>

The restored ESPRMUser instance, or null if no session is active


login(username, password): Promise<ESPRMUser>

Defined in: src/methods/ESPRMAuth/Login.ts:37

Authenticate with username and password.

string

The user’s email or username

string

The user’s password

Promise<ESPRMUser>

A new ESPRMUser instance with active session tokens

const auth = ESPRMBase.getAuthInstance();
const user = await auth.login("admin@example.com", "password123");

logout(): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/Logout.ts:21

Log out the current user and clear all stored tokens.

Promise<ESPAPISuccessResponse>

Success response from the server


sendSignUpCode(username, password): Promise<ESPAPISuccessResponse>

Defined in: src/methods/ESPRMAuth/SendSignUpCode.ts:23

Register a new user and send a verification code to their email.

string

The email or username to register

string

The password for the new account

Promise<ESPAPISuccessResponse>

Success response confirming the sign-up code was sent