Skip to content

backends-web-backend


Class: AuthService

Defined in: backends/web-backend/src/auth/auth.service.ts:46

Constructors

Constructor

new AuthService(userModel, jwtService, emailService, twoFactorService, oauthService, sessionsService, orgsService, analytics?): AuthService

Defined in: backends/web-backend/src/auth/auth.service.ts:47

Parameters

userModel

Model<Document<unknown, { }, User, { }, { }> & User & object & object>

jwtService

JwtService

emailService

EmailService

twoFactorService

TwoFactorService

oauthService

OAuthService

sessionsService

SessionsService

orgsService

OrgsService

analytics?

AnalyticsService

Returns

AuthService

Methods

checkAvailability()

checkAvailability(username?, email?): Promise<{ emailAvailable?: boolean; usernameAvailable?: boolean; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:58

Parameters

username?

string

email?

string

Returns

Promise<{ emailAvailable?: boolean; usernameAvailable?: boolean; }>


forgotPassword()

forgotPassword(payload): Promise<{ detail: string; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:279

Parameters

payload
identifier

string = ...

Returns

Promise<{ detail: string; }>


login()

login(payload, ctx): Promise<{ token: string; } | { challengeToken: string; twoFactorRequired: true; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:105

Parameters

payload
identifier

string = ...

password

string = ...

ctx

RequestContext

Returns

Promise<{ token: string; } | { challengeToken: string; twoFactorRequired: true; }>


loginTwoFactor()

loginTwoFactor(payload, ctx): Promise<{ token: string; } | { challengeToken: string; twoFactorRequired: true; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:121

Parameters

payload
challengeToken

string = ...

code

string = ...

ctx

RequestContext

Returns

Promise<{ token: string; } | { challengeToken: string; twoFactorRequired: true; }>


oauthCallback()

oauthCallback(provider, code, state, ctx): Promise<OAuthResult>

Defined in: backends/web-backend/src/auth/auth.service.ts:169

Parameters

provider

string

code

string

state

string

ctx

RequestContext

Returns

Promise<OAuthResult>


oauthStart()

oauthStart(provider, intent, token?, campaignToken?, visitorId?): Promise<string>

Defined in: backends/web-backend/src/auth/auth.service.ts:149

Parameters

provider

string

intent

string

token?

string

campaignToken?

string

visitorId?

string

Returns

Promise<string>


resetPassword()

resetPassword(payload): Promise<{ detail: string; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:297

Parameters

payload
newPassword

string = ...

token

string = ...

Returns

Promise<{ detail: string; }>


revokeSession()

revokeSession(jti): Promise<void>

Defined in: backends/web-backend/src/auth/auth.service.ts:275

Parameters

jti

string

Returns

Promise<void>


signup()

signup(payload): Promise<{ email: string; id: string; username: string; }>

Defined in: backends/web-backend/src/auth/auth.service.ts:73

Parameters

payload
campaignToken?

string = ...

email

string = ...

fullName

string = ...

organization

string = ...

password

string = ...

username

string = ...

visitorId?

string = ...

Returns

Promise<{ email: string; id: string; username: string; }>