Skip to content

Class: AuthEndpoint ​

Defined in: endpoints/auth.ts:21

Constructors ​

Constructor ​

ts
new AuthEndpoint(client): AuthEndpoint;

Defined in: endpoints/auth.ts:22

Parameters ​

ParameterType
clientRESTClient

Returns ​

AuthEndpoint

Methods ​

blockPasswordResets() ​

ts
blockPasswordResets(days): Promise<IBlockResetResponse>;

Defined in: endpoints/auth.ts:82

Parameters ​

ParameterType
daysnumber

Returns ​

Promise<IBlockResetResponse>


changePassword() ​

ts
changePassword(currentPassword, newPassword): Promise<IUpdatePasswordResponse>;

Defined in: endpoints/auth.ts:62

Parameters ​

ParameterType
currentPasswordstring
newPasswordstring

Returns ​

Promise<IUpdatePasswordResponse>


checkLoginStatus() ​

ts
checkLoginStatus(loginToken): Promise<IAuthResponse>;

Defined in: endpoints/auth.ts:125

Parameters ​

ParameterType
loginTokenstring

Returns ​

Promise<IAuthResponse>


completeAddEmail() ​

ts
completeAddEmail(validationToken): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:150

Completes from the emailed link. Nothing about the account is returned; refresh the user to see the method.

Parameters ​

ParameterType
validationTokenstring

Returns ​

Promise<IApiResponse>


completeEmailChange() ​

ts
completeEmailChange(validationToken): Promise<IUpdateEmailResponse>;

Defined in: endpoints/auth.ts:140

Changes the email to the address the link was sent to. Ends every sign-in on the account.

Parameters ​

ParameterType
validationTokenstring

Returns ​

Promise<IUpdateEmailResponse>


completeOAuthHandoff() ​

ts
completeOAuthHandoff(
   provider, 
   state, 
   result
): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:107

run by the browser after the provider redirects back; leaves the outcome for the waiting client

Parameters ​

ParameterType
providerstring
statestring
result| { code: string; } | { error: string; }

Returns ​

Promise<IApiResponse>


ts
completeOAuthLink(
   provider, 
   state, 
   code
): Promise<IAuthMethodsResponse>;

Defined in: endpoints/auth.ts:169

Completes a link started in this app, from the code the provider's callback page relayed.

Parameters ​

ParameterType
providerstring
statestring
codestring

Returns ​

Promise<IAuthMethodsResponse>


getCurrentUser() ​

ts
getCurrentUser(): Promise<IGetCurrentUserResponse>;

Defined in: endpoints/auth.ts:58

Returns ​

Promise<IGetCurrentUserResponse>


getOAuthLoginUrl() ​

ts
getOAuthLoginUrl(provider, handoffChallenge?): Promise<IOAuthAuthorizeUrlResponse>;

Defined in: endpoints/auth.ts:101

Parameters ​

ParameterType
providerstring
handoffChallenge?string

Returns ​

Promise<IOAuthAuthorizeUrlResponse>


listSignIns() ​

ts
listSignIns(): Promise<IListSignInsResponse>;

Defined in: endpoints/auth.ts:188

Returns ​

Promise<IListSignInsResponse>


login() ​

ts
login(
   email, 
   password, 
   options?
): Promise<IAuthResponse>;

Defined in: endpoints/auth.ts:29

persistent asks for a sign-in that lasts until it is signed out or revoked, as the mobile app's does, rather than one that lapses after a month without use.

Parameters ​

ParameterType
emailstring
passwordstring
options?{ persistent?: boolean; }
options.persistent?boolean

Returns ​

Promise<IAuthResponse>


logout() ​

ts
logout(refreshToken): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:54

End this sign-in on the server: its refresh token, every session made from it, and the push registration of the device it was on. Needs only the refresh token, so it works after the session has run out. Idempotent.

Parameters ​

ParameterType
refreshTokenstring

Returns ​

Promise<IApiResponse>


oauthCallback() ​

ts
oauthCallback(
   provider, 
   code, 
   state
): Promise<IAuthResponse>;

Defined in: endpoints/auth.ts:120

Parameters ​

ParameterType
providerstring
codestring
statestring

Returns ​

Promise<IAuthResponse>


pollLoginHandoff() ​

ts
pollLoginHandoff(verifier): Promise<
  | IAuthResponse
| IHandoffPendingResponse>;

Defined in: endpoints/auth.ts:116

the waiting client's check; the verifier goes in the body so it stays out of URLs and logs

Parameters ​

ParameterType
verifierstring

Returns ​

Promise< | IAuthResponse | IHandoffPendingResponse>


ts
pollOAuthLink(provider, verifier): Promise<
  | IAuthMethodsResponse
| IHandoffPendingResponse>;

Defined in: endpoints/auth.ts:174

The desktop app's check for a link finished in the system browser. The verifier goes in the body.

Parameters ​

ParameterType
providerstring
verifierstring

Returns ​

Promise< | IAuthMethodsResponse | IHandoffPendingResponse>


refreshSession() ​

ts
refreshSession(refreshToken): Promise<IRefreshTokenResponse>;

Defined in: endpoints/auth.ts:45

Parameters ​

ParameterType
refreshTokenstring

Returns ​

Promise<IRefreshTokenResponse>


register() ​

ts
register(email, password): Promise<IAuthResponse>;

Defined in: endpoints/auth.ts:37

Parameters ​

ParameterType
emailstring
passwordstring

Returns ​

Promise<IAuthResponse>


removeAuthMethod() ​

ts
removeAuthMethod(id, currentPassword?): Promise<IAuthMethodsResponse>;

Defined in: endpoints/auth.ts:184

Removes a sign-in method. The account must keep at least one usable method. Sign-ins stay active; the user can end them separately from Sessions.

Parameters ​

ParameterType
idnumber
currentPassword?string

Returns ​

Promise<IAuthMethodsResponse>


requestAddEmail() ​

ts
requestAddEmail(email, password): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:145

Adds an email and password to an account that signs in only with OAuth providers.

Parameters ​

ParameterType
emailstring
passwordstring

Returns ​

Promise<IApiResponse>


requestEmailChange() ​

ts
requestEmailChange(email, password): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:135

Sends a link to the new address. The account keeps its current email until that link is used, so a mistyped or unwanted address changes nothing.

Parameters ​

ParameterType
emailstring
passwordstring

Returns ​

Promise<IApiResponse>


requestEmailVerification() ​

ts
requestEmailVerification(email, loginToken?): Promise<IEmailVerifyResponse>;

Defined in: endpoints/auth.ts:90

Parameters ​

ParameterType
emailstring
loginToken?string

Returns ​

Promise<IEmailVerifyResponse>


requestPasswordReset() ​

ts
requestPasswordReset(email): Promise<IRequestPasswordResetResponse>;

Defined in: endpoints/auth.ts:69

Parameters ​

ParameterType
emailstring

Returns ​

Promise<IRequestPasswordResetResponse>


resetPassword() ​

ts
resetPassword(resetToken, newPassword): Promise<IResetPasswordResponse>;

Defined in: endpoints/auth.ts:75

Parameters ​

ParameterType
resetTokenstring
newPasswordstring

Returns ​

Promise<IResetPasswordResponse>


revokeOtherSignIns() ​

ts
revokeOtherSignIns(): Promise<IRevokeSignInsResponse>;

Defined in: endpoints/auth.ts:198

Ends every sign-in except the current one.

Returns ​

Promise<IRevokeSignInsResponse>


revokeSignIn() ​

ts
revokeSignIn(id): Promise<IApiResponse>;

Defined in: endpoints/auth.ts:193

Ends one sign-in other than the current one. Use logout for the current one.

Parameters ​

ParameterType
idstring

Returns ​

Promise<IApiResponse>


ts
startOAuthLink(provider, options?): Promise<IOAuthAuthorizeUrlResponse>;

Defined in: endpoints/auth.ts:158

Starts linking a provider to the signed-in account. Needs the current password when the account has one. The returned URL is opened in the browser.

Parameters ​

ParameterType
providerstring
options?{ currentPassword?: string; handoffChallenge?: string; }
options.currentPassword?string
options.handoffChallenge?string

Returns ​

Promise<IOAuthAuthorizeUrlResponse>


verifyEmail() ​

ts
verifyEmail(validationToken): Promise<IEmailVerifyResponse>;

Defined in: endpoints/auth.ts:95

Parameters ​

ParameterType
validationTokenstring

Returns ​

Promise<IEmailVerifyResponse>

Released under the GNU Affero General Public License v3.0.