Next.js Discord

Discord Forum

Next-Auth Firebase Bug

Answered
New Zealand Heading Dog posted this in #help-forum
Open in Discord
Avatar
New Zealand Heading DogOP
im using the firebase adapter on next-auth, but when i provide the firestore db in the adapter, it says undefined
Answered by European sprat
you const app definition looks different from here:

https://next-auth.js.org/v3/adapters/firebase
View full answer

18 Replies

Avatar
New Zealand Heading DogOP
Image
Here
Avatar
European sprat
I can't help you but I'd suggest showing some amount of code...
Avatar
New Zealand Heading DogOP
ok.
just a sec
 import NextAuth from "next-auth"
import GoogleProvider from "next-auth/providers/google"
import { FirebaseAdapter } from "@next-auth/firebase-adapter"

import { db } from "@/firebase.config"

export default NextAuth({
 
  providers: [
    GoogleProvider({
      clientId: process.env.GOOGLE_ID,
      clientSecret: process.env.GOOGLE_SECRET,
    }),
  ],
  secret:process.env.NEXT_AUTH_SECRET,
  adapter: FirebaseAdapter(db)
}) 
Image
Avatar
European sprat
let's see @/firebase.config
Avatar
New Zealand Heading DogOP
yeah
Image
this is the file
Avatar
European sprat
you const app definition looks different from here:

https://next-auth.js.org/v3/adapters/firebase
Answer
Avatar
New Zealand Heading DogOP
Hey
i found something..
my env variables are coming to be undefined
..
Avatar
New Zealand Heading DogOP
{error: {…}, url: '/api/auth/providers', message: Unexpected token '<', "<!DOCTYPE "... is not valid JSON}
Avatar
New Zealand Heading DogOP
i fixed it, it was version problem. followed the new version docs and it is done now 🙂 Thanks @European sprat for you help