What is the best practice of firestore security rules? #3850
-
TitleWhat is the best practice of firestore's security rules? How to reproduce ☕️
Your question/bug report 📓What is the best practice of firestore's security rules when using next-auth and firebase adapter together?Hi. there!
When applied as above code, it works normally, but it is insecure rules. Do I have to use "custom-auth" directly to get the value "request.auth"? I'm using @next-auth/firebase-adapter 0.1.3, firebase v8.6.2 and next-auth v.3.29.0. I would really appreciate it if someone gave me advice. 🙇♂️ Contributing 🙌🏽No, I'm afraid I cannot help regarding this |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Hi! I'm facing the same issue. I could sign In my users using the same uid , both in firestore and auth, but it seems I'm unable to pass through basic authentication rules. |
Beta Was this translation helpful? Give feedback.
-
@DiegoGonzalezCruz @NayamAmarshe Unfortunately, I haven't solved this problem. I think it shouldn't be used in a production environment if there are no firestore security rules like now. If you want to use firebase for custom auth, see here.
|
Beta Was this translation helpful? Give feedback.
-
Hi guys, for everyone wondering about firestore rules and next-auth adapter, I will try to help you out. To make it work, you need to re-write all the logic, using the firebase Admin SDK, following the documentation for Node. Here you can see an example I'm using. I hope it works! |
Beta Was this translation helpful? Give feedback.
-
@saseungmin Please check.
This is an example of implementing the description above. I made an adapter package that works like my example. I will use this package until I apply from the official adapter. |
Beta Was this translation helpful? Give feedback.
@saseungmin Please check.
@DiegoGonzalezCruz I don't see your example! But it looks like a similar approach to mine. I also think that the current firebase adapter should be changed. User private data in firebase cannot be used in frontend because the current method does not go through firebase-auth. I also faced this problem, and I succeeded in connecting next-auth and firebase-auth similar to the session method in the following way.