godotnuts / godotfirebase Goto Github PK
View Code? Open in Web Editor NEWImplementations of Firebase for Godot using GDScript
License: MIT License
Implementations of Firebase for Godot using GDScript
License: MIT License
Having a Wiki is great, but as the project grows, perhaps the class documentation should also be included in the editor for faster referencing; similar to how the built-in class references can also be found in the editor.
Describe the bug
I'm testing out the updates in #124 and Realtime Database is crashing when trying to listen to a path on this line: https://github.com/GodotNuts/GodotFirebase/blob/main/addons/godot-firebase/database/reference.gd#L123 because _auth_obj
is null.
Full stack trace:
When I put a breakpoint on https://github.com/GodotNuts/GodotFirebase/blob/main/addons/godot-firebase/database/reference.gd#L26 the onready is called after my code. So it seems I need to wait longer for it to be ready before using it? How can I do that?
To Reproduce
Here's some example code that reproduces it:
func _ready():
Firebase.Auth.connect("signup_succeeded", self, "_create_game")
Firebase.Auth.connect("login_succeeded", self, "_create_game")
Firebase.Auth.connect("login_failed", self, "_on_auth_error")
Firebase.Auth.login_anonymous()
func _create_game(auth_result : Dictionary):
var rooms_ref : FirebaseDatabaseReference = Firebase.Database.get_database_reference("/games/code-breaker/rooms/", {})
It crashes in _create_game
Expected behavior
I expect this to connect to that path in the database and not crash.
Environment:
I have problem when doing with Firebase Database. I have been figuring out what was going on with it, by analyzing this addon, for why doesn't it work.
The Auth here works, but The Firestore no longer works. I even tried the demo if I made wrong, but infact The demo also no longer works for updloading firebase
I have tried different method to do with Firebase, by trying the simpler script found in GDQuest tutorial here. and its finished file right here. Here I created another script to become the Singleton under different node name, let's say FirebaseQuest
.
and GDQuest version works right away (both Auth and Firestore), no problem
here's example of push
from GDQuest
func save_document(path: String, fields: Dictionary, http: HTTPRequest) -> void:
var document := { "fields": fields }
var body := to_json(document)
var url := FIRESTORE_URL + path
http.request(url, _get_request_headers(), false, HTTPClient.METHOD_POST, body)
and yours from FirebaseReference.gd
func push(data):
var to_push = JSON.print(data)
if pusher.get_http_client_status() == HTTPClient.STATUS_DISCONNECTED:
pusher.request(_get_list_url() + db_path + _get_remaining_path(), PoolStringArray(), true, HTTPClient.METHOD_POST, to_push)
else:
push_queue.append(data)
Let me now comment what best I could understand. correct me if wrong, it's quite complicated for me to learn back this addon, I know.:
HTTPClient.STATUS_DISCONNECTED
), well that mean it should be able to write so, since the http is not connected right now.{"fields":fields}
in which the "fields"
contains all the data you'd like to push or update with. I think the upload structure might have changed, so it's no longer compatible with older technique.var tobePush = {
"fields":{
"Auza":{"stringValue":"aaaaaaaaaaaw"}
},
}
stringValue
there. the datatype has to be defined first. Haven't seen again if your demo had one.var data = { "aaaa" : {"stringValue" : "sample" } }
FirebaseQuest.push(data)
and that's it. it works (assuming you abide by your Firestore rule e.g. logged in).
what's going on?
I have a realtime database set up and I am trying to get data from it. I could only find new_data_update and patch_data_update signals, how do I get existing data?
I want to check if user is logged in for both chat online presence and security reasons.
Any links that point to old repo need to be fixed
The rEADME needs an update to fix the git clone commands
When I tried to get a database reference, I get the error Invalid call. Nonexistent function 'size' in base 'bool'.
I have placed no filters.
Godot version: 3.2.2, no mono support
Full error:
FirebaseReference.gd:119 if path == separator and data.size() > 0:
FirebaseReference.gd:61 _route_data(command, data.path, data.data)
HTTPSSEClient.gd:86 emit_signal("new_sse_event", headers, event_data.event, result)
In the current state of the code the file might not open correctly causing a hard crash of the plugin. There needs to be some sort of error handling to account for this.
By adding an error check and printing the error it will resolve the issue
Godot documentation to support fix
https://docs.godotengine.org/en/stable/classes/[email protected]#enum-globalscope-error
Currently we are missing small things like the ability to edit emails or passwords. Firebase has everything listed in the REST API we can do.
We should look into adding
https://firebase.google.com/docs/reference/rest/auth#top_of_page
When app detect any error it always have code 400 but error message is ok.
but anyway....
THIS PLUGIN IS AWESOME!!!!!!!!!!!!!!!!!!
I finaly found easy to use advanced firebase plugin!
I have a request. Add comments to each function with examples for each argument. Otherwise. I do not understand in which argument to enter the file name / path of the file that I want to send / download from the Firebase Storage server. Would you be willing to write an example in the comment on how to send / download a file to / from Firebase Storage? I need this in my online scoreboard in game. And if you can, 'finish' it - #13
I want to change user DisplayName
How?
in the function on_new_sse_event(headers, event, data): in FirebaseReference.gd "data" comes as an string, then data.path and data.data in _route_data(command, data.path, data.data) fails
i think that can be fixed just likle this: _route_data(command, parse_json(data).path, parse_json(data).data) or in HTTPSSEClient.gd emit_signal("new_sse_event", headers, event_data.event, parse_json(event_data.data)) (that is what i do)
I'm trying this plugin out for an upcoming project. However, I'm having some issues with the login process using an existing Google account.
In my firebase app, I've enabled the google authentication integration, and I have been given both web client ID and secret, but I can't see a way to add this in the plugin.
When I try to login (using Firebase.Auth.login_with_email_and_password) I get a 403 - The request is missing a valid API key.
I've added all the relevant parameters in the Project Settings > Firebase > Environment Variables such as API key, auth domain, etc as provided by Firebase when I've created the app.
I'll take a look in the plugin's code and Firebase API to see if I can integrate something in case is missing, I'd appreciate any help or good pointers.
Thanks
I had a few bugs:
I want to pull from a database that uses the users uid for information
Hello,
Does it support analytics?
Thanks!
No sure if that's just me but when I tried to use the OAuth workflow it didn't work at the beginning and I was getting the following error:
error code: 400
message: INVALID_IDP_RESPONSE : Invalid Idp Response: the Google id_token is not allowed to be used with this application. Its audience (OAuth 2.0 client ID) is xxxxxxxxxxxx.apps.googleusercontent.com, which is not authorized to be used in the project with project_number: yyyyyyyyyyyy
where xxxxxxxxx.apps.etc. it's the client ID I've created in the google console, while yyyyyyy is the project ID in Firebase.
To make it work I've added the google console client ID in the Whitelist for the google sign-in method in Firebase (there is an optional section called "Whitelist client IDs from external projects (optional)".
I thought I should mention this, perhaps it's worth adding this explanation in the Wiki
These would be good so we have a general outline for people to use when reporting a bug, or requesting a new feature to us.
Perhaps the new Firebase Storage API can come in the form of a file manager UI. Somewhat like the editor file system, except a folder can't be empty.
Originally posted by @SIsilicon in #56 (comment)
I get this error when trying to set a listener to Firebase.Database.get_database_reference().
The error is in line 55 of FirebaseReference.gd:55.
func set_listener(listener_ref):
if !listener:
listener = listener_ref
add_child(listener)
listener.connect("new_sse_event", self, "on_new_sse_event")
var base_url = _get_list_url().trim_suffix(separator)
var extended_url = separator + db_path + _get_remaining_path(false)
listener.connect_to_host(base_url, extended_url)
The function receives a listener_ref of type Node, which doesn't have the "connect_to_host" method.
Align code style with the official GDScript style guide.
This will make the plugin more consistent, giving the main dev team (us) and future contributors a common style more than practices, without changing our way to code but just how it is presented through APIs.
note: heavy refactoring based on files' names and foldering, without changing functionalities or structure.
In order to support having multiple games that use the plugin on the same device, we need some way to identify different login files. I figure something like the game-name itself should be good enough.
While working with Firestore, I managed to create a Document in the console that contains a collection of other documents. This type is currently missing from the list and it would be very useful for our users. I'll work around it for now by adding the same document to the previous collection and find a better way to structure the initial collection name, but we'll need to implement it, since (apparently) this is a valid setup in Firestore.
Firstly, thank you for this plugin! It is proving to be very useful in a game I'm working on. I'm even considering to contribute to the storage api.
Something is bothering me about the source code though. all the tabs seemed to have doubled. Where there would be one tab, there's two. Where there'd be two tabs, there's four. This does not adhere to the gdscript style guide in the docs, and also wastes valuable scripting space.
If you'd like, I can do make a pull request with the changes.
I am trying to run the demo project by cloning (I also correctly updated the HTTPSSEClient submodule in res://addons/GDFirebase/HTTPSSEClient) and scanning the folder. A project named TestFirebaseJS has been located. I initialized everything on Firebase and I am actually logging in and creating an user on Firebase, so it seems to work.
Immediately after the login/user creation I am getting an error "Invalid get index 'Storage' (on base: 'Node (Firebase.gd)')." at https://github.com/WolfgangSenff/GodotFirebase/blob/29839469e2ee0b2b0136b5ca0822cc03530c4b68/Demo/ChatControl.gd#L16 and in fact I do not see any ".Storage" symbol in Firebase.gd (but I am new on Godot/GDScript so this could be my fault). I then noticed that the two Firebase.gd files (https://github.com/WolfgangSenff/GodotFirebase/blob/master/GDFirebase/Firebase.gd vs https://github.com/WolfgangSenff/GodotFirebase/blob/master/Demo/addons/GDFirebase/Firebase.gd) are different, so I tried to overwrite the demo addons/GDIFirebase folder with the other, but still with no luck, same error.
is ChatControl.gd line 16 redundant because the var is already initialized with the correct type at line 5? commenting line 16 seems to work...
Took a while to get everything out (for example the need for submodule update, you should mention it, I tried by just copying the files from a download of the master and it was obviously broken), but all of this seems very interesting. You should do some release or at least tag some known-to-work master commit... Also, would be nice if the demo was aligned with the latest version of the library - again, using a git submodule? But I suppose you should split the repository in two, one with the lib and the other with the demo (never used submodules)...
Thanks, later
Aaron
Hey, is there any chance for FB and Twitter sign in any time soon?
Firebase.gd
, which means hard coded, instead of doing so from separate .gitignore
-able file.gitignore
this,.gitignore
will also be created ignoring the setup save file.let's say you are Open Source and upload to GitHub. I use GitHub Desktop to do Git easily with UI.
.gitignore
Firebase.gd
once you are going to use it.Firebase.gd
(because other cloners could get script not found error during project load), maybe don't fill the config just yet before the fix comes.As we start to build out Firebase-UI-like components, I thought it made sense to have a TileMap that could maintain itself via an active connection to Firebase. This should also give an easy way to upload the map data to Firestore so that people can build their maps in the editor and effectively "export" them to Firestore.
As far as possible, add other functions such as logging in and registering in with all FireBase-supported methods and restoring the user account password
Is your feature request related to a problem? Please describe.
Currently there is no way to have a user log out of the system or remove the local auth file
Describe the solution you'd like
A method to do this
Describe alternatives you've considered
N/A
Additional context
N/A
Recently, an update broke the paths to the http-see-client plugin in the demo as well as the main solution. It shouldn't affect how the Firebase plugin itself works, nor the demo, but it bothers me, so I'm fixing it.
Along with that, I'm refactoring the code so the singleton used is a scene rather than a script; this gets us the ability to have nodes under the parent that represent the features implemented.
Hi, I can't get document from collection, which already exists (I created document on Firebase side)
Collection name is 'allusers' and document name is 'admin'
func _on_Button2_pressed():
# get existing document
var coll = Firebase.Firestore.collection('allusers')
var doc = coll.get('admin')
print(doc) # prints Null
I noticed that in firestore.gd, collections
variable is also Null:
func collection(path : String) -> FirestoreCollection:
if !collections.has(path):
var coll : FirestoreCollection = FirestoreCollection.new()
coll.extended_url = extended_url
coll.base_url = base_url
coll.config = config
coll.auth = auth
coll.collection_name = path
print(collections) # prints Null
collections[path] = coll
add_child(coll)
return coll
else:
return collections[path]
which is incorrect as collection and all data exists.
Recontinue issue #33 ...
Oh. no..
Let me clarify:
begin_refresh
_ready()
on main Firebase.gd anymore? Haven't seen the node reference of Storage....Firebase.Auth
, and Firebase.Database
. that's it. where's the other? is it separately referenced out of Firebase.gd
? it seems those unreferenced ones supposed to be referenced via Firebase.gd
first beforehand, but it's absent Firebase.Firestore
, Firebase.Storage
, or whatever other. Because it had no self initialization _ready
like to connect signals to parent node whom the node was instancing.https://firebase.google.com/docs/reference/rest/database?hl=en . I didn't know that I do is for Realtime Database
curl -X POST -d "{ \"first\": \"Jack\", \"last\": \"Sparrow\" }" "https://sandboxon-407f9.firebaseio.com/users/jack/name.json"
Above is when Project-id.firebaseio.com
which is Realtime Databse
https://www.youtube.com/watch?v=-vDNk7BzOGc
https://github.com/GDQuest/godot-demos/blob/master/2019/05-21-firebase-firestore/end/interface/profile/UserProfile.gd . I tried to manually makeshift the curl synthax to replicate the HTTPCLient's request. It did work if did in supposed way, but I couldn't figure out working synthax for cmd.exe.
curl -X POST -d {"fields":{"Crondle":{"stringValue":"JOELwindows7"}}} "https://firestore.googleapis.com/v1/projects/sandboxon-407f9/databases/(default)/documents/PlesWork/unadio10"
โ Command not work. Above is when firestore.googleapis.com
which is cloud firestore.
I confused the Databasing feature as Cloud Firestore as most Tutorials that covers it, implements Firebase database feature, prepares Cloud Firestore, while actually this Plugin did used Realtime Database instead, as in the demo and what Firebase.gd currently initialize.
Bellow this is when it finally works
What I supposed to do is to Setup Realtime Database from now.
Instead of Cloud Firestore (Though you should prepare that too just in case needed later).
Because the demo uses Realtime Database. oh, I didn't know that.
I get missing refresh token after the login has timed out, how do I set it up so it refreshes while the application is opened?
https://firebase.google.com/docs/reference/dynamic-links/link-shortener
This is only the link-shortener, but appears that's all we have access to through REST at the moment.
Hi,
I just want to know if it's works for firebase storage ans if the plugin works on android
thanks
Hello:
Please put a video, by all steps, for instalations, make database, and recover data, chat, analitics, etc !!!
thanks !!!
Just installing following https://github.com/GodotNuts/GodotFirebase/wiki/Installation-and-Activation and found a few issues:
GDFirebase
to addons folder. But this repo has 3 folders in master: godot-firebase
, gut
, and http-sse-client
. Do all 3 of these need to be copied?override.cfg
file I filled in the variables but they didn't appear in Project Settings after reload. it has [firebase/environment_variables]
at the top. I changed this to [GodotFirebase/environment_variables]
(so it's the same as the plugin name) and then the environment variables turned up in the editor.When I try to use Firebase it's giving me No configuration settings found, add them in override.cfg file.
I assume this is because it's not detecting the environment variables correctly maybe because of the name change. Looking into this now.
Does this work for iOS? Also do the analytics work? Looking for something that would track conversion events for installs from Google Ads.
I'm testing the new OAuth integration (btw thanks a million to implementing this feature so quickly!!), I've got an error in the FirebaseUserData class (file: user_data.gd), the exception is raised for row 20 where the field passwordUpdatedAt is not in the payload returned by google during the authentication transaction.
I've commented the row for now and it all worked fine after few other hiccups that got sorted automagically (if it happens again I'll open a new issue)
Create repositories backed by either the Realtime Database or Firestore. Point-and-click interface should allow creation of special Firebase objects that can then be created/retrieved in the backend repository. See https://www.youtube.com/watch?v=1a9O67xg3l0 for how this might look.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.