This is a Deta adapter for next-auth
.
- Install this package,
next-auth-deta
, as well asnext-auth
anddeta
.
# npm
npm install next-auth-deta next-auth deta
# yarn
yarn add next-auth-deta next-auth deta
# pnpm
pnpm add next-auth-deta next-auth deta
- Add the adapter to your next-auth config in
pages/api/auth/[...nextauth].js
. Add yourDETA_PROJECT_KEY
as an environment variable, then create a deta instance and pass it to theDetaAdapter
.
import NextAuth from "next-auth";
import GithubProvider from "next-auth/providers/github";
import { DetaAdapter } from "next-auth-deta";
import { Deta } from "deta";
const deta = Deta(process.env.DETA_PROJECT_KEY);
export default NextAuth({
adapter: DetaAdapter(deta),
providers: [
// add your providers here
// https://next-auth.js.org/providers
],
// more options
});