This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a faunadb adapter for next-auth | |
* original source: https://gist.github.com/s-kris/fbb9e5d7ba5e9bb3a5f7bd11f3c42b96 | |
* create collections and indexes in your faunadb shell(dashboard or cli) using the following queries: | |
CreateCollection({name: 'accounts'}); | |
CreateCollection({name: 'sessions'}); | |
CreateCollection({name: 'users'}); | |
CreateCollection({name: 'verification_requests'}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// followed from next-auth repo: https://github.com/nextauthjs/next-auth | |
// create faunadb server key | |
// create collections: users, accounts, sessions, verificationRequests | |
// create required indexes | |
import faunadb, { query as q } from 'faunadb'; | |
import { v4 as uuidv4 } from 'uuid'; | |
import { createHash, randomBytes } from 'crypto'; |