Advertisement
kor_leone

Untitled

Apr 26th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1.     public void initialize()
  2.     {
  3.         UnityInitializer.AttachToGameObject(this.gameObject);
  4.         credentials = new CognitoAWSCredentials(poolid, RegionEndpoint.APNortheast2);
  5.  
  6.         PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
  7.                                                  //.AddOauthScope("https://www.googleapis.com/auth/games")
  8.                                                  //.AddOauthScope("profile")
  9.                                                  .RequestIdToken()
  10.                                                  //.RequestServerAuthCode(false)
  11.                                                  .Build();
  12.         PlayGamesPlatform.InitializeInstance(config);
  13.         PlayGamesPlatform.DebugLogEnabled = true;
  14.         PlayGamesPlatform.Activate();
  15.         Social.localUser.Authenticate(GoogleLoginCallback);
  16.     }
  17.    
  18.     void GoogleLoginCallback(bool success, string err)
  19.     {
  20.         if(success)
  21.         {
  22.             string token = PlayGamesPlatform.Instance.GetIdToken();
  23.             //string token = ((PlayGamesLocalUser)Social.localUser).GetIdToken();
  24.             //string token = PlayGamesPlatform.Instance.GetServerAuthCode();
  25.             Debug.Log("Token = " + token);
  26.             //credentials.AddLogin("accounts.google.com", token);
  27.         }
  28.         else
  29.         {
  30.             Debug.Log("에러 내용: " + err);
  31.             Debug.LogError("Google login failed. If you are not running in an actual Android/iOS device, this is expected.");
  32.         }
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement