Skip to main content

Abstract Class: BaseRegistrationRouteSQL

Defined in: auth/src/routes/sql/BaseRegistrationRouteSQL.ts:8

Provides a simple account registration flow that verifies an e-mail or phone number using OTP authentication before creating the account.

The registration flow:

  1. Client calls POST /start with either an e-mail address of phone number to verify.
  2. Sends an OTP code to the provided email or phone number in step 1.
  3. Client calls POST /verify with the email or phone number and OTP code.
  4. If OTP code is verified, creates a new User and Alias, returns a valid JWT token.

Extends​

Constructors​

Constructor​

new BaseRegistrationRouteSQL(): BaseRegistrationRouteSQL

Returns​

BaseRegistrationRouteSQL

Inherited from​

BaseRegistrationRoute.constructor

Properties​

aliasClass​

protected aliasClass: any = AliasSQL

Defined in: auth/src/routes/sql/BaseRegistrationRouteSQL.ts:9

Overrides​

BaseRegistrationRoute.aliasClass


aliasRepo?​

protected optional aliasRepo?: RepoUtils<AliasSQL>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:86

Inherited from​

BaseRegistrationRoute.aliasRepo


auditLogUtils?​

protected optional auditLogUtils?: AuditLogUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:63

Inherited from​

BaseRegistrationRoute.auditLogUtils


defaultScopes​

protected defaultScopes: string[] = []

Defined in: auth/src/routes/BaseRegistrationRoute.ts:66

Inherited from​

BaseRegistrationRoute.defaultScopes


jwtConfig?​

protected optional jwtConfig?: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:69

Inherited from​

BaseRegistrationRoute.jwtConfig


logger​

protected logger: any

Defined in: auth/src/routes/BaseRegistrationRoute.ts:72

Inherited from​

BaseRegistrationRoute.logger


messagingUtils?​

protected optional messagingUtils?: MessagingUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:75

Inherited from​

BaseRegistrationRoute.messagingUtils


rateLimiter?​

protected optional rateLimiter?: RateLimiter

Defined in: auth/src/routes/BaseRegistrationRoute.ts:78

Inherited from​

BaseRegistrationRoute.rateLimiter


systemSettingsClass​

protected systemSettingsClass: any = SystemSettingsSQL

Defined in: auth/src/routes/sql/BaseRegistrationRouteSQL.ts:10

Overrides​

BaseRegistrationRoute.systemSettingsClass


systemSettingsUtils?​

protected optional systemSettingsUtils?: SystemSettingsUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:60

Inherited from​

BaseRegistrationRoute.systemSettingsUtils


tokenUtils?​

protected optional tokenUtils?: TokenUtils

Defined in: auth/src/routes/BaseRegistrationRoute.ts:81

Inherited from​

BaseRegistrationRoute.tokenUtils


trustedProxies​

protected trustedProxies: string[] = []

Defined in: auth/src/routes/BaseRegistrationRoute.ts:84

Inherited from​

BaseRegistrationRoute.trustedProxies


userClass​

protected userClass: any = UserSQL

Defined in: auth/src/routes/sql/BaseRegistrationRouteSQL.ts:11

Overrides​

BaseRegistrationRoute.userClass


userRepo?​

protected optional userRepo?: RepoUtils<UserSQL>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:87

Inherited from​

BaseRegistrationRoute.userRepo

Methods​

initialize()​

protected initialize(): Promise<void>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:90

Returns​

Promise<void>

Inherited from​

BaseRegistrationRoute.initialize


isRegistrationAllowed()​

protected isRegistrationAllowed(): Promise<boolean>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:121

Returns true if new accounts may currently be registered. Reads the runtime SystemSettings when systemSettingsClass is set, otherwise (or for anything not stored) falls back to @Config("auth:allowRegistration").

Returns​

Promise<boolean>

Inherited from​

BaseRegistrationRoute.isRegistrationAllowed


start()​

start(body, req): Promise<Record<string, never>>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:132

Sends a one-time verification code to the provided e-mail address or phone number.

Parameters​

body​

StartBody

req​

HttpRequest

Returns​

Promise<Record<string, never>>

Inherited from​

BaseRegistrationRoute.start


verify()​

verify(body, req, res): Promise<AuthResult>

Defined in: auth/src/routes/BaseRegistrationRoute.ts:222

Verifies the one-time code sent by start(). On success, creates a new User and verified Alias and returns an JWT token.

Parameters​

body​

VerifyBody

req​

HttpRequest

res​

HttpResponse

Returns​

Promise<AuthResult>

Inherited from​

BaseRegistrationRoute.verify