'How to provide this Firestore Security Rule

I am trying to write some security rules to my firestore. There is 2 section in my db, one of them is guest info and other one is passwords.

All the things about guest info works at my NextJS code.

But i am updating my passwords daily with another javascript file.

Here is the security rule of my db currently

allow read, write: if request.auth != null;

if i keep the rules like this i am not able to update my passwords with my other javascript file because i can not send authed request to firestore. How can i solve my problem?



Solution 1:[1]

If the other JS file runs on a server, you can use Firebase Admin SDK instead that bypasses any security rules. Then you don't have to authenticate like in Client SDKs but just ensure that the script can be called by authorized users only.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dharmaraj