Skip to main content

Interface: Adapter

adapters.Adapter

Using a custom adapter you can connect to any database backend or even several different databases. Custom adapters created and maintained by our community can be found in the adapters repository. Feel free to add a custom adapter from your project to the repository, or even become a maintainer of a certain adapter. Custom adapters can still be created and used in a project without being added to the repository.

Resources​

Methods​

createSession​

β–Έ createSession(session): Awaitable<AdapterSession>

Creates a session for the user and returns it.

Parameters​

NameType
sessionObject
session.expiresDate
session.sessionTokenstring
session.userIdstring

Returns​

Awaitable<AdapterSession>


deleteSession​

β–Έ deleteSession(sessionToken): Promise<void> | Awaitable<undefined | null | AdapterSession>

Deletes a session from the database. It is preferred that this method also returns the session that is being deleted for logging purposes.

Parameters​

NameType
sessionTokenstring

Returns​

Promise<void> | Awaitable<undefined | null | AdapterSession>


getUserByAccount​

β–Έ getUserByAccount(providerAccountId): Awaitable<null | AdapterUser>

Using the provider id and the id of the user for a specific account, get the user.

Parameters​

NameType
providerAccountIdPick<AdapterAccount, "provider" | "providerAccountId">

Returns​

Awaitable<null | AdapterUser>


deleteUser​

β–Έ Optional deleteUser(userId): Promise<void> | Awaitable<undefined | null | AdapterUser>

Todo

This method is currently not implemented. Defining it will have no effect

Parameters​

NameType
userIdstring

Returns​

Promise<void> | Awaitable<undefined | null | AdapterUser>


unlinkAccount​

β–Έ Optional unlinkAccount(providerAccountId): Promise<void> | Awaitable<undefined | AdapterAccount>

Todo

This method is currently not implemented. Defining it will have no effect

Parameters​

NameType
providerAccountIdPick<AdapterAccount, "provider" | "providerAccountId">

Returns​

Promise<void> | Awaitable<undefined | AdapterAccount>


useVerificationToken​

β–Έ Optional useVerificationToken(params): Awaitable<null | VerificationToken>

Return verification token from the database and delete it so it cannot be used again.

Parameters​

NameType
paramsObject
params.identifierstring
params.tokenstring

Returns​

Awaitable<null | VerificationToken>