Overview
An Adapter in NextAuth.js connects your application to whatever database or backend system you want to use to store data for user accounts, sessions, etc.
The adapters can be found in their own repository under nextauthjs/adapters
.
There you can find the following adapters:
Custom Adapter​
See the tutorial for creating a database Adapter for more information on how to create a custom Adapter. Have a look at the Adapter repository to see community maintained custom Adapter or add your own.
Editor integration​
When writing your own custom Adapter in plain JavaScript, note that you can use JSDoc to get helpful editor hints and auto-completion like so:
/** @type { import("next-auth/adapters").Adapter } */
const MyAdapter = () => {
return {
async getAdapter() {
return {
// your adapter methods here
}
},
}
}
This will work in code editors with a strong TypeScript integration like VSCode or WebStorm. It might not work if you're using more lightweight editors like VIM or Atom.