diff --git a/addons/godot-firebase/auth/auth.gd b/addons/godot-firebase/auth/auth.gd index ec6c24c..b16bb9d 100644 --- a/addons/godot-firebase/auth/auth.gd +++ b/addons/godot-firebase/auth/auth.gd @@ -139,6 +139,13 @@ var _update_profile_body : Dictionary = { "returnSecureToken":true } +var link_account_body : Dictionary = { + "idToken":"", + "email":"", + "password":"", + "returnSecureToken":true +} + var _local_port : int = 8060 var _local_uri : String = "http://localhost:%s/"%_local_port var _local_provider : AuthProvider = AuthProvider.new() @@ -555,6 +562,18 @@ func update_account(idToken : String, displayName : String, photoUrl : String, d is_busy = false Firebase._printerr("Error updating account: %s" % err) +# Link account with Email and Password +func link_account(email : String, password : String) -> void: + if _is_ready(): + is_busy = true + link_account_body.idToken = auth.idtoken + link_account_body.email = email + link_account_body.password = password + var err = request(_base_url + _update_account_request_url, _headers, HTTPClient.METHOD_POST, JSON.stringify(link_account_body)) + if err != OK: + is_busy = false + Firebase._printerr("Error updating account: %s" % err) + # Function to send a account verification email func send_account_verification_email() -> void: