GodotNuts / GodotFirebase

Implementations of Firebase for Godot using GDScript
MIT License
517 stars 74 forks source link

Error in the function get_doc in Godot 4.0.3 #377

Closed minadaniel closed 6 months ago

minadaniel commented 6 months ago

Hi, this is my first time here and sorry if this problem has been fixed before but I searched before posting it here.

I activated anonymous login on firebase for my project and I created a collection named cities.

In my application, I wrote this for anonymous login as in wiki Firebase.Auth.login_anonymous(), then inside signup_succeeded(auth_info: Dictionary) function, I emit other signal to begin loading data named load_data and connect it to another scene. This function worked properly when I tested it by printing auth_info.

Inside other scene I defined my collection then wrote get_doc

@onready var collection : FirestoreCollection = Firebase.Firestore.collection('cities')
collection.get_doc('الأقصر')

Then I got this error: [Firebase Error] >> Action in error was: 0 [Firebase Error] >> Missing or insufficient permissions.

How to fix this?

WolfgangSenff commented 6 months ago

It looks just like another issue that was just posted and fixed. The problem is with your rules in Firestore. See this for more: https://github.com/GodotNuts/GodotFirebase/issues/376 I'll go ahead and close this, feel free to re-open if you find this doesn't fix your issue.

minadaniel commented 6 months ago

In the rules, allow read write is already written not get as in the issue you mentioned. allow read, write: if false;

Also, I started my application in production not test, I don't know if this is a problem

** Update: I changed the rules to allow read: if request.auth != null and it worked. Thank you for helping me.