Skip to content
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

the rules file in firestore not working #32

Closed
furjac opened this issue Mar 2, 2024 · 6 comments
Closed

the rules file in firestore not working #32

furjac opened this issue Mar 2, 2024 · 6 comments

Comments

@furjac
Copy link

furjac commented Mar 2, 2024

What would you like to share?

so basically i was trying to store data but a error poped up like
Error during signup: [Errno 403 Client Error: Forbidden for url:
https://firestore.googleapis.com/v1/projects/fgsmmpanel/databases/(default)/doc
uments:commit?key=apikey {
"error": {
"code": 403,
"message": "Missing or insufficient permissions.",
"status": "PERMISSION_DENIED"
}
}

and this is the rule file config
Error during signup: [Errno 403 Client Error: Forbidden for url:
https://firestore.googleapis.com/v1/projects/fgsmmpanel/databases/(default)/doc
uments:commit?key=AIzaSyBUizgx29lr-l07YEjylOgQRDe5WSdnmyA] {
"error": {
"code": 403,
"message": "Missing or insufficient permissions.",
"status": "PERMISSION_DENIED"
}
}
and this is the code

user_doc = fsdb.collection('users-wallet').document(user_info_['users'][0]['email']).get()
wallet_balance = user_doc.get('wallet', 0)

Additional information

what am doing wrong or is it wrong with rules file cuz if i give
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
allow read, write;
}
}
it works fine

im so stressed

@AsifArmanRahman
Copy link
Owner

Please follow the instruction from firestore here.

As the issue is not a bug of the library, it'll be closed.

@furjac
Copy link
Author

furjac commented Mar 4, 2024

no i mean if i used : if request.auth != null this then why its not working then the data base not at all writeable
nor readable

@furjac
Copy link
Author

furjac commented Mar 4, 2024

image
ok this is the result maybe i have to use like this

@furjac
Copy link
Author

furjac commented Mar 4, 2024

but how to use can u give a simple example

@AsifArmanRahman
Copy link
Owner

@furjac

When you have the below rule for firestore

if request.auth != null

user = auth.sign_in_with_email_and_password(email, password)

data = {
   "name": "Iron Man"
}

db.collection('Marvels').document('Movies').set(data, token=user['idToken'])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants