AuthService
Can authenticate a user based on email password combination
Constructors
constructor
**new AuthService**(«destructured»)
Parameters
Properties
__configModule__
Record<string, unknown>__container__
anyRequired__moduleDeclaration__
Record<string, unknown>manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequiredAccessors
activeManager_
Protected get**activeManager_**(): EntityManager
Returns
EntityManager
EntityManager
EntityManagerRequiredMethods
atomicPhase_
Protected **atomicPhase_**<TypeParameter TResult, TypeParameter TError>(work, isolationOrErrorHandler?, maybeErrorHandlerOrDontFail?): Promise<TResult>
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise<TResult>
Promise
Promise<TResult>Requiredauthenticate
**authenticate**(email, password): Promise<[AuthenticateResult](/references/services/types/AuthenticateResult)>
Authenticates a given user based on an email, password combination. Uses scrypt to match password with hashed value.
Parameters
email
stringRequiredpassword
stringRequiredReturns
Promise<AuthenticateResult>
authenticateAPIToken
**authenticateAPIToken**(token): Promise<[AuthenticateResult](/references/services/types/AuthenticateResult)>
Authenticates a given user with an API token
Parameters
token
stringRequiredReturns
Promise<AuthenticateResult>
authenticateCustomer
**authenticateCustomer**(email, password): Promise<[AuthenticateResult](/references/services/types/AuthenticateResult)>
Authenticates a customer based on an email, password combination. Uses scrypt to match password with hashed value.
Parameters
email
stringRequiredpassword
stringRequiredReturns
Promise<AuthenticateResult>
comparePassword_
Protected **comparePassword_**(password, hash): Promise<boolean>
Verifies if a password is valid given the provided password hash
Parameters
password
stringRequiredhash
stringRequiredReturns
Promise<boolean>
Promise
Promise<boolean>RequiredshouldRetryTransaction_
Protected **shouldRetryTransaction_**(err): boolean
Parameters
err
Record<string, unknown> | { code: string }RequiredReturns
boolean
boolean
booleanwithTransaction
**withTransaction**(transactionManager?): [AuthService](/references/services/classes/AuthService)
Parameters
transactionManager
EntityManager