Skip to content

Commit

Permalink
Merge pull request #428 from T0d3v/4.x
Browse files Browse the repository at this point in the history
Add link_account() function
  • Loading branch information
WolfgangSenff authored Sep 27, 2024
2 parents 8b5c2cf + ecd204a commit 74ac6e8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions addons/godot-firebase/auth/auth.gd
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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

0 comments on commit 74ac6e8

Please sign in to comment.