Skip to content

Instantly share code, notes, and snippets.

@RameshRavone
Last active April 8, 2017 05:33
Show Gist options
  • Select an option

  • Save RameshRavone/21c70cacb87e286215a99ba9615c0bf8 to your computer and use it in GitHub Desktop.

Select an option

Save RameshRavone/21c70cacb87e286215a99ba9615c0bf8 to your computer and use it in GitHub Desktop.
godot firebase google auth.
extends Node
var firebase = null;
var sqlbridge = null;
func _ready():
if OS.get_name() == "Android":
firebase = Globals.get_singleton("FireBase");
sqlbridge = Globals.get_singleton("SQLBridge");
firebase.initWithFile("res://godot-firebase-config.json", get_instance_ID());
get_node("Buttons/gConnect").connect("button_down", self, "login");
get_node("Buttons/gDisConnect").connect("button_down", self, "logout");
pass
func login():
if (!firebase.is_google_connected()):
firebase.google_sign_in();
pass
func logout():
if (firebase.is_google_connected()):
firebase.google_sign_out();
pass
func _recive_message(from, key, data):
if from == "FireBase":
print("Key: ", key, " Data: ", data);
if key == "GoogleLogin" && data == "true": Print("Google Signed in");
if key == "GoogleLogin" && data == "false": Print("Google Signed out");
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment