Skip to content

Instantly share code, notes, and snippets.

@LukmanaAfif
Last active January 7, 2020 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LukmanaAfif/dc0d0b7dbcfc8b0ffdbbee12ea0cf2cb to your computer and use it in GitHub Desktop.
Save LukmanaAfif/dc0d0b7dbcfc8b0ffdbbee12ea0cf2cb to your computer and use it in GitHub Desktop.
Login with Launcher
private const string AUTHORIZATION_CODE_ENVIRONMENT_VARIABLE = "JUSTICE_AUTHORIZATION_CODE";
//Attempts to login with launcher
public void LoginWithLauncher()
{
// Check if auth code is available from launcher
string authCode = Environment.GetEnvironmentVariable(AUTHORIZATION_CODE_ENVIRONMENT_VARIABLE);
if (authCode != null)
{
abUser.LoginWithLauncher(OnLogin);
// Toogle loading animation
uiHandler.FadeLoading();
}
else
{
Debug.Log("LoginWithLauncher authCode is null");
}
}
//Handles User Login, on Success it will get the User's account details
private void OnLogin(Result result)
{
if (result.IsError)
{
uiHandler.FadeLoading();
Debug.Log("Login failed:" + result.Error.Message);
Debug.Log("Login Response Code: " + result.Error.Code);
//Show Error Message
}
else
{
Debug.Log("Login successful. Getting User Data");
//Show Login Successful
//Show "Getting User Details"
GetUserDetails();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment