BaseAuth inherits from the Auth abstract class and is the basic implementation for user authentication types, using JWT as the authentication method. In most cases, you can extend user authentication types by inheriting from BaseAuth, and there is no need to inherit directly from the Auth abstract class.
constructor()Constructor, creates a BaseAuth instance.
constructor(config: AuthConfig & { userCollection: Collection })| Parameter | Type | Description |
|---|---|---|
config | AuthConfig | See Auth - AuthConfig |
userCollection | Collection | User collection, e.g., db.getCollection('users'). See DataBase - Collection |
user()Accessor, sets and gets user information. By default, it uses the ctx.state.currentUser object for access.
set user()get user()check()Authenticates via the request token and returns user information.
signIn()User sign-in, generates a token.
signUp()User sign-up.
signOut()User sign-out, expires the token.
validate() *Core authentication logic, called by the signIn interface, to determine if the user can sign in successfully.