Fork of the official SvelteKit Auth example for Auth.js


SvelteKit Auth Neo4j - Example App

Open Source. Full Stack. Own Your Data.

npm Bundle Size Downloads TypeScript

Overview

This is a fork of the official SvelteKit Auth example for Auth.js, to show how to use it with Neo4j adapter.

Neo4j Adapter

// hooks.server.ts

import { SvelteKitAuth } from "@auth/sveltekit"
import GitHub from "@auth/core/providers/github"
import { GITHUB_ID, GITHUB_SECRET, NEO4J_PASSWORD, NEO4J_URI, NEO4J_USER } from "$env/static/private"
import neo4j from "neo4j-driver"
import { Neo4jAdapter } from "@next-auth/neo4j-adapter"

const driver = neo4j.driver(
  NEO4J_URI,
  neo4j.auth.basic(NEO4J_USER, NEO4J_PASSWORD)
)

const neo4jSession = driver.session()
export const handle = SvelteKitAuth({
  providers: [GitHub({ clientId: GITHUB_ID, clientSecret: GITHUB_SECRET })],
  adapter: Neo4jAdapter(neo4jSession),
})

The adapter automatically synchronizes users with the Neo4j database on login :

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes