Skip to content

eh_GJUsersAuth

Daniel Queiroz Porto edited this page Sep 28, 2020 · 2 revisions

Inherits: Node > Object

Description

Node to manage requests to the users/auth endpoint. It wil instantiate and remove eh_GJUsersAuthRequest nodes as needed.

It is able to read credentials from gamejolt's ".gj-credentials" the game launcher creates, has methods to facilitate login, and auto-saving user credentials.

Properties

type property default value
bool is_logged_in False

Methods

return type method signature
String get_player_username()
String get_player_user_token()
bool has_player_credentials()
null self_login(String p_username, String p_user_token)
null request(String p_username, String p_user_token)

Signals

  • gj_auth_completed(eh_gj_users_auth_data)

Signal emitted when auth request is successfuly completed. Sends an eh_GJUsersAuthData resource as parameter


  • gj_auth_failed(error_dictionary)

Signal emitted when auth request fails. The dictionary format can vary according to the type of error


Constants

  • USER_CREDENTIALS_PATH = res://addons/eh_jogos_game_jolt_api/gj_user_credentials.res --- Path where user credentials are saved as a binary file custom resource.

Properties Descriptions

is_logged_in

_Default_ `False`
Flag to tell if player credentials has been successfully checked and logged in.

Method Descriptions

get_player_username

  • String get_player_username()

Returns player username retrieved either from saved credentials, or from ".gj-credentials" file generated by gamejolt launcher.


get_player_user_token

  • String get_player_user_token()

Returns player game token retrieved either from saved credentials, or from ".gj-credentials" file generated by gamejolt launcher.


has_player_credentials

  • bool has_player_credentials()

Returns true if player credentials has already been found and/or saved.


self_login

Auto Auth request for the player. It's a helper for login in the current player without needing to whory about username and game token, but it accepts them as optional parameters, and in case they're used it will save them as the new default credentials. Emits [gj_auth_completed] signal if completed successfully or [gj_auth_failed] if not.


request

Sends auth request for the username and token passsed. Will not overwrite default credentials. Emits [gj_auth_completed] signal if completed successfully or [gj_auth_failed] if not.