New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
My NextAuth auth system does not create users in firebase(Authentication as Firestore). #10280
Comments
Don't use NextAuth on App router. Atleast that is what i came to conclusion via my experience. |
Is it fixing when I just don't use App Router? Really? |
Not even a return for how many days, great team, excellent project, The last praises I said is not serious. |
|
Hi GroophyLifefor, (First > I am not a maintainer just am browsing the adapter implementations and saw your issue here) I think you need to change how you import your env vars. These packages are for 2 different environments here.
To use the client side library you have to follow next.js rules for environment variables. And so for client side code you have to prepend So I expect your client side firebase app is not initiated / will not work when deployed
Suggest for your client side file and firebase import /initialization to change to a config more similar to
See the next.js repo for their examples and how they explicitly differentiate the client side firebase in its own file etc And then I understand can be frustrating when coding, but also can consider this project is open source and lot of adapters and surface area to maintain. We can all try and be more considerate of people giving their valuable free time to help the web run smoothly. If still stuck send me a message and I can help you. I use and have been using the firebase adapter with firebase-admin 11 in next.js projects and working well. |
@NickFoden Thank you for your reply and I remember trying this, unfortunately I can't make new attempts to fix because I have removed next-auth from the project and never to use this curse again. I hope the project gets what it deserves, it's unbelievable that a package supported by Vercel is so bad note: I use Google's apis and it's easier because at least it works. |
In case someone else if facing the same issue, in order to authenticate the user also on the Firebase Authentication dashboard, you just need to use For the longer answer, I'll leave you with this exhaustive example here on StackOverflow that I've recently posted (tbh it was related to the Firebase Stripe extension, but the main issue was exactly the one discussed here). Hope this helps! |
create file name called next-auth.d.ts
create folder firebase/admin.tsadapter for google or github authentications
create a components/FirebaseAuthprovider.tsx
create a file in components/Sessionprovider.tsx
after this rap this in layout.tsx
if your using google provider wrap that firebaseauthprovider it is not working in credentials provider because firebaseauth provider use this in auth.ts
**now next auth is updated Simplify Server-side Authentication: Replace the various server-side authentication methods ( getServerSession function call in most cases. getSession withAuth getToken useSession single auth()** |
how we can do with credentials provider ? how to store the data in database when sign up session callbacks |
Adapter type
@auth/firebase-adapter
Environment
System:
OS: Windows 11 10.0.22621
CPU: (12) x64 11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz
Memory: 1.04 GB / 7.75 GB
Binaries:
Node: 21.6.1 - C:\Program Files\
odejs\
ode.EXE
npm: 10.4.0 - C:\Program Files\
odejs\
pm.CMD
Browsers:
Edge: Chromium (122.0.2365.80)
Internet Explorer: 11.0.22621.1
npmPackages:
@auth/firebase-adapter: ^1.5.0 => 1.5.0
next: 14.1.3 => 14.1.3
next-auth: ^4.24.7 => 4.24.7
react: ^18 => 18.2.0
Reproduction URL
https://github.com/GroophyLifefor/reproduction
Describe the issue
Please READ HERE
First stage - traditional
the auth part of my project is divided into two parts.
route.ts
options.ts
The problem I'm having here is, first of all, I get an error like this when compiling.
This is like a warning but it says error in Vercel deployment and CI/CD stops.
and when I log in, it doesn't register in firebase.
But it's the only one I can log in, so it's a huge plus. that's is why this way first stage
Second Stage - Carriage
route.ts
options.ts - (M)odified
At this stage I no longer get the import error in the build phase, but I get another error that runtime error.
error
also auth too not working!
Third Stage - With over-research and deep found ways
route.ts
options.ts - (M)odified
Previously I was only initializing firebase, I was doing it in a file called firestore.ts, I didn't feel the need to add it because there is nothing magical, it just initializes plain.
I imported firebase-admin as
import * as admin from 'firebase-admin'
in this case take care as admin so It's not confict with firebase-app initialize
and finally I have made some changes to my home page,
page.tsx
also mine env was
so provider and adapter values was okey, but still error
error
How to reproduce
Actually I couldn't get rid of these errors no matter what I did, if you try to setup it in a normal way you may get these errors.
Expected behavior
error-free, bug-free life
The text was updated successfully, but these errors were encountered: