Skip to content
Snippets Groups Projects

feat(smauth): Add steam login

Merged Gilles Roudière requested to merge implement_steam_login into main
+ 39
1
@@ -63,7 +63,45 @@ func login_device_auto():
cfg.save(file)
return login_device(cfg.get_value(section, "device_id"), cfg.get_value(section, "device_key"))
## Login using a Steam auth token.
##
## This only work if steam login provider is enabled in the backend.
##
## [param identity] The identity used to generate the auth token. This can be
## any value that would identify your service/game.
##
## [param ticket] The hexadecimal-encoded binary of the authentication ticket returned
## by Steam's GetAuthTicketForWebApi SDK function.
## See https://partner.steamgames.com/doc/api/ISteamUser#GetAuthTicketForWebApi.
##
## Example usage with GodotSteam (https://godotsteam.com/).
## [codeblock]
## # Request a web API ticket.
## var identity = "my_godot_game"
## var ticket_id = Steam.getAuthTicketForWebApi(identity)
## assert(ticket_id != 0)
##
## # Get the ticket for the response.
## var res
## var res_ticket_id = 0
## while res_ticket_id != ticket_id:
## res = await Steam.get_ticket_for_web_api
## res_ticket_id = res[0]
## assert(res[1] == 1) # Check if request was successful (result = 1).
##
## var ticket_buffer = res[3]
##
## # Login using token.
## var response = await W4GD.auth.login_steam(identity, (ticket_buffer as PackedByteArray).hex_encode()).async()
## [/codeblock]
##
## Note: setting up GodotSteam requires more than this code snippet (some configuration
## and callbacks setup). Check out https://godotsteam.com/tutorials/initializing/ and
## https://godotsteam.com/tutorials/authentication/ for more information.
##
## Note: while GodotSteam is not a strict requirement for using this login method, a
## way to access the Steam SDK within Godot is required. Right now, GodotSteam is the
## easiest way to achieve this, so its usage is very recommanded.
func login_steam(identity: String, ticket: String):
return begin_sso(
"anon.localhost"
Loading