AccountsServer <CustomUser>
Index
Constructors
constructor
Type parameters
- CustomUser: User = User
Parameters
options: AccountsServerOptions<CustomUser>
services: AuthenticationServices<CustomUser> | Record<string, new (args: any) => AuthenticationService<CustomUser>>
db: any
optionaldbSessions: any
Returns AccountsServer<CustomUser>
Properties
publiccontext
publicoptions
publicservices
Methods
publicactivateUser
Parameters
userId: string
User id.
Returns Promise<void>
- Return a Promise.
publicauthenticateWithService
Parameters
serviceName: string
params: any
infos: ConnectionInformations
Returns Promise<boolean>
publiccreateTokens
Parameters
__namedParameters: { isImpersonated?: boolean; token: string; user: CustomUser }
Returns Promise<Tokens>
- Return a new accessToken and refreshToken.
publicdeactivateUser
Parameters
userId: string
User id.
Returns Promise<void>
- Return a Promise.
publicfindSessionByAccessToken
Parameters
accessToken: string
Returns Promise<Session>
- Return a session.
publicfindUserById
Parameters
userId: string
User id.
Returns Promise<null | CustomUser>
- Return a user or null if not found.
publicgetHooks
Returns Emittery<Record<PropertyKey, any>, Record<PropertyKey, any> & _OmnipresentEventData, DatalessEventNames<Record<PropertyKey, any>>>
publicgetOptions
Returns AccountsServerOptions<CustomUser>
publicgetServices
Returns AuthenticationServices<CustomUser>
publicimpersonate
Parameters
accessToken: string
User access token.
impersonated: ImpersonationUserIdentity
impersonated user.
infos: ConnectionInformations
User connection informations.
Returns Promise<ImpersonationResult>
- ImpersonationResult
publicloginWithService
Parameters
serviceName: string
params: any
infos: ConnectionInformations
Returns Promise<LoginResult>
publicloginWithUser
Parameters
user: CustomUser
The user object.
infos: ConnectionInformations
User's connection informations.
Returns Promise<LoginResult>
- Session tokens and user object.
publiclogout
Parameters
accessToken: string
User access token.
Returns Promise<void>
- Return a promise.
publicon
Subscribe to an accounts-js event.
accountsServer.on(ServerHooks.ValidateLogin, ({ user }) => {
// This hook is called every time a user try to login
// You can use it to only allow users with verified email to login
});Parameters
eventName: string
callback: HookListener
Returns () => void
Returns void
publicprepareMail
Parameters
to: string
token: string
user: CustomUser
pathFragment: string
emailTemplate: EmailTemplateType
from: string
Returns any
publicrefreshTokens
Parameters
accessToken: string
User access token.
refreshToken: string
User refresh token.
infos: ConnectionInformations
User connection informations.
Returns Promise<LoginResult>
- LoginResult.
publicresumeSession
Parameters
accessToken: string
User JWT access token.
Returns Promise<CustomUser>
Return the user associated to the session.
publicsanitizeUser
Parameters
user: CustomUser
Returns CustomUser
Activate a user.