Next-Auth Dgraph DQL/GraphQL Database Adapter

Has anyone created a Dgraph DQL/GraphQL database adapter for next-auth?

Thinking this probably varies as schema is different, just beginning to learn next-auth, so feel free to chime in with any advice in this area.

With firebase auth? You need an auth provider to use it…

J

Well not firebase. First pass we want to just use our database as the source for password based credentials. And I believe we (@pbassham) got that working with just a simple signin callback. But we need to persist sessions to a database to be able to use those sessions by pointer reference in SSR with Next.js. There is a bunch (really just a few) of adapters made already for working with different sql flavors, mongo, dynamodb, and fauna. But there is nothing for Dgraph. We don’t want to silo this data away from our graph but connect it. Why have a graph if we have to keep siloing parts of connected data out to other sources. So building off from the prisma adapter I believe would be the way to go. It would require a minimum schema to make it work, but that is not the limitation to what that data can connect to. Eventually we want to make it so that a user can authenticate through whatever provider they want and we link it to the same user by email address. So we offload all authentication to any provider but store in graph the users sessions so we can manage and track them within one cohesive graph.

Hello Amaster ! I’ve just push a PR for a Dgraph/graphql adapter ! :tada:
https://github.com/nextauthjs/adapters/pull/170

Unfortunately, next-auth discourage the use of credentials in favor of OAuth and passwordless authentication. So this adapter and more generally the next-auth package won’t be useful if you want to use a password flavored authentication flow in combination with Dgraph.

2 Likes