ESPRMAuth
Defined in: src/ESPRMAuth.ts:11
Shell class for authentication operations. Methods are added via prototype augmentation in methods/ESPRMAuth/*.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ESPRMAuth():
ESPRMAuth
Returns
Section titled “Returns”ESPRMAuth
Methods
Section titled “Methods”changePassword()
Section titled “changePassword()”changePassword(
oldPassword,newPassword):Promise<ESPAPISuccessResponse>
Defined in: src/methods/ESPRMAuth/ChangePassword.ts:23
Change the password for the currently authenticated user.
Parameters
Section titled “Parameters”oldPassword
Section titled “oldPassword”string
The current password
newPassword
Section titled “newPassword”string
The new password
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response confirming the password was changed
confirmForgotPassword()
Section titled “confirmForgotPassword()”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.
Parameters
Section titled “Parameters”username
Section titled “username”string
The user’s email or username
password
Section titled “password”string
The new password
verificationCode
Section titled “verificationCode”string
The code received via email
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response confirming the password was reset
confirmSignUp()
Section titled “confirmSignUp()”confirmSignUp(
username,verificationCode,tags?):Promise<ESPAPISuccessResponse>
Defined in: src/methods/ESPRMAuth/ConfirmSignUp.ts:24
Confirm a new user registration with the verification code.
Parameters
Section titled “Parameters”username
Section titled “username”string
The email or username that was registered
verificationCode
Section titled “verificationCode”string
The code received via email
string[]
Optional tags to associate with the new user
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response confirming the sign-up
forgotPassword()
Section titled “forgotPassword()”forgotPassword(
username):Promise<ESPAPISuccessResponse>
Defined in: src/methods/ESPRMAuth/ForgotPassword.ts:25
Initiate the forgot-password flow. Sends a verification code to the user.
Parameters
Section titled “Parameters”username
Section titled “username”string
The user’s email or username
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response confirming the code was sent
getLoggedInUser()
Section titled “getLoggedInUser()”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.
Returns
Section titled “Returns”Promise<ESPRMUser | null>
The restored ESPRMUser instance, or null if no session is active
login()
Section titled “login()”login(
username,password):Promise<ESPRMUser>
Defined in: src/methods/ESPRMAuth/Login.ts:37
Authenticate with username and password.
Parameters
Section titled “Parameters”username
Section titled “username”string
The user’s email or username
password
Section titled “password”string
The user’s password
Returns
Section titled “Returns”Promise<ESPRMUser>
A new ESPRMUser instance with active session tokens
Example
Section titled “Example”const auth = ESPRMBase.getAuthInstance();const user = await auth.login("admin@example.com", "password123");logout()
Section titled “logout()”logout():
Promise<ESPAPISuccessResponse>
Defined in: src/methods/ESPRMAuth/Logout.ts:21
Log out the current user and clear all stored tokens.
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response from the server
sendSignUpCode()
Section titled “sendSignUpCode()”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.
Parameters
Section titled “Parameters”username
Section titled “username”string
The email or username to register
password
Section titled “password”string
The password for the new account
Returns
Section titled “Returns”Promise<ESPAPISuccessResponse>
Success response confirming the sign-up code was sent