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

Add link_account() function #428

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions addons/godot-firebase/auth/auth.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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:
Expand Down