/// <summary> /// Sign on using a google token. /// </summary> /// <param name="token">Token obtained with a native Google-Play plugin</param> public static void SignOnWithGoogle(string token) { LoginMethodUsed = LoginPathways.googlePlus; LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest(); request.AccessToken = token; request.CreateAccount = true; PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoginResult, OnLoginError); }
private void OnNewAuthCodeReceived(Action <LoginResult> loginSuccess, Action <PlayFabError> loginFailure, string authCode) { #if UNITY_ANDROID var request = new LoginWithGoogleAccountRequest() { ServerAuthCode = authCode, CreateAccount = true }; PlayFabClientAPI.LoginWithGoogleAccount(request, (LoginResult loginResult) => { OnPlayerLogin(loginResult); loginSuccess.Invoke(loginResult); IsLogged = true; PlayFabId = loginResult.PlayFabId; }, (PlayFabError e) => loginFailure.Invoke(e)); #endif }
public virtual void Perform(string authCode) { var request = new LoginWithGoogleAccountRequest { ServerAuthCode = authCode, CreateAccount = true }; PlayFabClientAPI.LoginWithGoogleAccount(request, ResultCallback, ErrorCallback); }
void LoginPlayfabWithGoogleAccount() { var request = new LoginWithGoogleAccountRequest { TitleId = PlayFabSettings.TitleId, ServerAuthCode = GPGSAuthentication.platform.GetServerAuthCode(), PlayerSecret = GPGSAuthentication.Instance.playerSecrect, CreateAccount = true }; PlayFabClientAPI.LoginWithGoogleAccount(request, RequestPhotonToken, OnPlayFabError); }
public override void OnEnter() { PlayFabSettings.TitleId = titleId.Value; var request = new LoginWithGoogleAccountRequest() { TitleId = titleId.Value, AccessToken = token.Value, CreateAccount = createAccount.Value }; PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoginSucces, OnLoginFailure); }
LoginWithGoogleAccountRequest GetGoogleRequest(string authCode) { LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest(); request.TitleId = PlayFabSettings.TitleId; request.ServerAuthCode = authCode; request.CreateAccount = true; request.InfoRequestParameters = new GetPlayerCombinedInfoRequestParams() { GetUserInventory = true, GetPlayerStatistics = true, GetUserVirtualCurrency = true, GetPlayerProfile = true, GetTitleData = true }; return(request); }
public void AuthenticateWithGoogle(string i_authCode) { LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest() { TitleId = TITLE_ID, ServerAuthCode = i_authCode }; PlayFabClientAPI.LoginWithGoogleAccount(request, (result) => { UnityEngine.Debug.LogError("Logged in with playfab id " + result.PlayFabId); mPlayFabId = result.PlayFabId; mSessionTicket = result.SessionTicket; IAuthenticationSuccess successResult = null; MyMessenger.Instance.Send <IAuthenticationSuccess>(BackendMessages.AUTH_SUCCESS, successResult); }, (error) => { HandleError(error, BackendMessages.AUTH_FAIL); }); }
private void HandleAndroidLoginMethod(Action <LoginResult> loginSuccess, Action <PlayFabError> loginFailure) { #if UNITY_ANDROID if (GameServiceManager.GameService.IsSignedIn) { if (GameData.Current.LoginType != LoginType.Undefined && GameData.Current.LoginType != LoginType.GameService) { HandleAndroidDeviceIdLoginMethod(loginSuccess, loginFailure, true); return; } string authCode; if (IsFirtsLogin) { authCode = ((GooglePlayGameService)GameServiceManager.GameService).GetServerAuthCode(); } else { ((GooglePlayGameService)GameServiceManager.GameService).GetAnotherServerAuthCode((string code) => OnNewAuthCodeReceived(loginSuccess, loginFailure, code)); return; } var request = new LoginWithGoogleAccountRequest() { ServerAuthCode = authCode, CreateAccount = true }; PlayFabClientAPI.LoginWithGoogleAccount(request, (LoginResult loginResult) => { OnPlayerLogin(loginResult); loginSuccess.Invoke(loginResult); IsLogged = true; PlayFabId = loginResult.PlayFabId; }, (PlayFabError e) => loginFailure.Invoke(e)); GameData.Current.LoginType = LoginType.GameService; } else { HandleAndroidDeviceIdLoginMethod(loginSuccess, loginFailure); } #endif }
private void OnAuthentificateWithGoogle(bool Success) { if (Success) { LoggedWithGooglePlay = true; var serverAuthCode = PlayGamesPlatform.Instance.GetServerAuthCode(); LoginWithGoogleAccountRequest LoginRequest = new LoginWithGoogleAccountRequest() { TitleId = PlayFabSettings.TitleId, ServerAuthCode = serverAuthCode, CreateAccount = true }; PlayFabClientAPI.LoginWithGoogleAccount(LoginRequest, OnPlayfabGooglePlayLoginSuccess, OnPlayfabGooglePlayLoginError); } else { Debug.LogWarning("Google : Failed to Login with Google Play : Fallback to Android Device Login"); SignInWithAndroidDevice(); } }
/// <summary> /// Not implemented yet. /// </summary> public static void LoginAccountNative() { //prompt for platform login Google Play, Gamecenter etc //then call native logins #if UNITY_ANDROID LoginWithGoogleAccountRequest request = new LoginWithGoogleAccountRequest() { TitleId = PlayFabSettings.TitleId, ServerAuthCode = "", InfoRequestParameters = instance.accountParams }; PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoggedIn, OnLoginError); #elif UNITY_IOS LoginWithGameCenterRequest request = new LoginWithGameCenterRequest() { TitleId = PlayFabSettings.TitleId, PlayerId = "", InfoRequestParameters = instance.accountParams }; PlayFabClientAPI.LoginWithGameCenter(request, OnLoggedIn, OnLoginError); #endif }
public override void OnEnter() { PlayFabSettings.TitleId = titleId.Value; #if UNITY_IOS var request = new LoginWithGameCenterRequest() { TitleId = titleId.Value, PlayerId = UnityEngine.Social.localUser.id, CreateAccount = createAccount.Value }; PlayFabClientAPI.LoginWithGameCenter(request, OnLoginSucces, OnLoginFailure); #elif UNITY_ANDROID var request = new LoginWithGoogleAccountRequest() { TitleId = titleId.Value, AccessToken = token.Value, CreateAccount = createAccount.Value }; PlayFabClientAPI.LoginWithGoogleAccount(request, OnLoginSucces, OnLoginFailure); #endif }