跳至內容
從 NextAuth.js v4 遷移?請閱讀 我們的遷移指南.
API 參考@auth/pouchdb-adapter

@auth/pouchdb-adapter

Auth.js / NextAuth.js 的官方 PouchDB 轉接器。

安裝

npm install pouchdb pouchdb-find @auth/pouchdb-adapter

PouchDBAdapterOptions

設定轉接器

屬性

索引?

optional indexes: IndexConfig;

覆寫預設的索引名稱。

預設值
{
  userByEmail: "nextAuthUserByEmail",
  accountByProviderId: "nextAuthAccountByProviderId",
  sessionByToken: "nextAuthSessionByToken",
  verificationTokenByToken: "nextAuthVerificationRequestByToken"
}

pouchdb

pouchdb: Database<{}>;

您的 PouchDB 實例,已安裝 pouchdb-find 外掛程式。

範例
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;

覆寫預設的前綴名稱。

預設值
{
  user: "USER",
  account: "ACCOUNT",
  session: "SESSION",
  verificationToken: "VERIFICATION-TOKEN"
}

PouchDBAdapter()

PouchDBAdapter(options): Adapter

參數

參數類型
選項PouchDBAdapterOptions

回傳

轉接器


createIndexes()

createIndexes(pouchdb, indexes?): Promise<void>

參數

參數類型
pouchdb資料庫<{}>
索引?IndexConfig

回傳

Promise<void>

Auth.js © Balázs Orbán 和團隊 -2024