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β
Name | Type |
---|---|
session | Object |
session.expires | Date |
session.sessionToken | string |
session.userId | string |
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β
Name | Type |
---|---|
sessionToken | string |
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β
Name | Type |
---|---|
providerAccountId | Pick <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β
Name | Type |
---|---|
userId | string |
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β
Name | Type |
---|---|
providerAccountId | Pick <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β
Name | Type |
---|---|
params | Object |
params.identifier | string |
params.token | string |
Returnsβ
Awaitable
<null
| VerificationToken
>