Next-auth: Add support for additional databases

Created on 27 Jan 2018  路  4Comments  路  Source: nextauthjs/next-auth

The current example next-auth.functions.js works with Mongo and NeDB.

I'd like to add support for other databases, including SQL databases like MySQL/MariaDB and Postgres - as well as other NoSQL databases and alternate drivers such as Mongoose.

Example alternative configs are welcome.

enhancement help wanted

Most helpful comment

kudos @gielcobben for your repo -> https://github.com/gielcobben/next-auth-sequelize.

All 4 comments

I'm trying to add MySQL as database but I'm not sure what I need to return on these functions:

  • find({id,email,emailToken,provider})
  • insert(user)
  • update(user)
  • remove(id)
  • serialize(user)
  • deserialize(id)

Thanks for asking @gielcobben! I've just added some documentation here, I hope it helps:

https://github.com/iaincollins/next-auth/wiki/Functions

It would be amazing to have a config that has MySQL support.

If you'd like some help on testing one out would be happy to assist.

kudos @gielcobben for your repo -> https://github.com/gielcobben/next-auth-sequelize.

That was outstanding work @gielcobben thank you for that. <3

Very happy to say this long standing issue should finally be addressed in 2.0, which uses TypeORM and will ship with support for a range of databases (without having to write custom handlers!)

Version 2.0 also comes with models and schemas much like the examples in next-auth-sequelize which can be easily extended or modified - they are exported as next-auth/models.

Think it's safe to close this one off now, but feel free to follow up!

Was this page helpful?
0 / 5 - 0 ratings