@auth/pouchdb-adapter
Official PouchDB adapter for Auth.js / NextAuth.js.
Installation
npm install pouchdb pouchdb-find @auth/pouchdb-adapter
PouchDBAdapterOptions
Configure the adapter
Properties
indexes?
optional indexes: IndexConfig;
Override the default index names.
Default
{
userByEmail: "nextAuthUserByEmail",
accountByProviderId: "nextAuthAccountByProviderId",
sessionByToken: "nextAuthSessionByToken",
verificationTokenByToken: "nextAuthVerificationRequestByToken"
}
pouchdb
pouchdb: Database<{}>;
Your PouchDB instance, with the pouchdb-find
plugin installed.
Example
import PouchDB from "pouchdb"
PouchDB
.plugin(require("pouchdb-adapter-leveldb")) // Or any other adapter
.plugin(require("pouchdb-find")) // Don't forget the `pouchdb-find` plugin
const pouchdb = new PouchDB("auth_db", \{ adapter: "leveldb" \})
#### prefixes?
```ts
optional prefixes: PrefixConfig;
Override the default prefix names.
Default
{
user: "USER",
account: "ACCOUNT",
session: "SESSION",
verificationToken: "VERIFICATION-TOKEN"
}
PouchDBAdapter()
PouchDBAdapter(options): Adapter
Parameters
Parameter | Type |
---|---|
options | PouchDBAdapterOptions |
Returns
createIndexes()
createIndexes(pouchdb, indexes?): Promise<void>
Parameters
Parameter | Type |
---|---|
pouchdb | Database <{}> |
indexes ? | IndexConfig |
Returns
Promise
<void
>