/// <summary> /// 커스텀 로그인 할떄 호출할것 /// </summary> public void Login() { var request = new PlayFab.ClientModels.LoginWithEmailAddressRequest { Email = email, Password = password }; PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSuccess, OnLoginFail); }
private void LoginWithEmail() { PlayFabSettings.TitleId = titleId; PlayFabSettings.DeveloperSecretKey = devSecretKey; var loginRequest = new ClientModels.LoginWithEmailAddressRequest(); loginRequest.Email = email; loginRequest.Password = password; PlayFabClientAPI.LoginWithEmailAddress(loginRequest, LoginCallBack, SharedFailCallback("LoginWithEmailAddress")); }
public static void LoginWithEmail(string titleId, string devSecretKey, string email, string password) { PlayFabSettings.TitleId = titleId; PlayFabSettings.DeveloperSecretKey = devSecretKey; var loginRequest = new LoginWithEmailAddressRequest(); loginRequest.Email = email; loginRequest.Password = password; PlayFabClientAPI.LoginWithEmailAddress(loginRequest, LoginCallBack, PfSharedControllerEx.FailCallback("LoginWithEmailAddress")); }
public virtual void Execute() { // CreateObject var CreateObject14_Object = new LoginWithEmailAddressRequest(); CreateObject14_Object.TitleId = PlayfabLoginSystem.Instance.TitleId; CreateObject14_Object.Email = Event.Email; CreateObject14_Object.Password = Event.Password; CreateObject14_Result = CreateObject14_Object; ActionNode13_request = CreateObject14_Result; // ActionNode // Visit PlayFab.PlayFabClientAPI.LoginWithEmailAddress PlayFab.PlayFabClientAPI.LoginWithEmailAddress(ActionNode13_request, ActionNode13_resultCallback, ActionNode13_errorCallback, ActionNode13_customData); }
/// <summary> /// Signs the user into the PlayFab account, returning a session identifier that can subsequently be used for API calls which require an authenticated user /// </summary> public static void LoginWithEmailAddress(LoginWithEmailAddressRequest request, LoginWithEmailAddressCallback resultCallback, ErrorCallback errorCallback) { request.TitleId = PlayFabSettings.TitleId ?? request.TitleId; if(request.TitleId == null) throw new Exception ("Must be have PlayFabSettings.TitleId set to call this method"); string serializedJSON = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action<string,string> callback = delegate(string responseStr, string errorStr) { LoginResult result = null; PlayFabError error = null; ResultContainer<LoginResult>.HandleResults(responseStr, errorStr, out result, out error); if(error != null && errorCallback != null) { errorCallback(error); } if(result != null) { AuthKey = result.SessionTicket ?? AuthKey; if(resultCallback != null) { resultCallback(result); } } }; PlayFabHTTP.Post(PlayFabSettings.GetURL()+"/Client/LoginWithEmailAddress", serializedJSON, null, null, callback); }
public void InvalidLogin() { // If the setup failed to log in a user, we need to create one. var request = new ClientModels.LoginWithEmailAddressRequest(); request.TitleId = PlayFabSettings.TitleId; request.Email = USER_EMAIL; request.Password = USER_PASSWORD + "INVALID"; var task = PlayFabClientAPI.LoginWithEmailAddressAsync(request); task.Wait(); UUnitAssert.NotNull(task.Result); UUnitAssert.Null(task.Result.Result); UUnitAssert.NotNull(task.Result.Error); UUnitAssert.True(task.Result.Error.ErrorMessage.Contains("password")); }
public void LoginWithAdvertisingId() { PlayFabSettings.AdvertisingIdType = PlayFabSettings.AD_TYPE_ANDROID_ID; PlayFabSettings.AdvertisingIdValue = "PlayFabTestId"; var loginRequest = new ClientModels.LoginWithEmailAddressRequest(); loginRequest.Email = USER_EMAIL; loginRequest.Password = USER_PASSWORD; loginRequest.TitleId = PlayFabSettings.TitleId; var loginTask = PlayFabClientAPI.LoginWithEmailAddressAsync(loginRequest); loginTask.Wait(); UUnitAssert.Equals(PlayFabSettings.AD_TYPE_ANDROID_ID + "_Successful", PlayFabSettings.AdvertisingIdType); }
public void LoginOrRegister() { if (!PlayFabClientAPI.IsClientLoggedIn()) // If we haven't already logged in... { var loginRequest = new ClientModels.LoginWithEmailAddressRequest(); loginRequest.Email = USER_EMAIL; loginRequest.Password = USER_PASSWORD; loginRequest.TitleId = PlayFabSettings.TitleId; var loginTask = PlayFabClientAPI.LoginWithEmailAddressAsync(loginRequest); loginTask.Wait(); if (loginTask.Result != null && loginTask.Result.Result != null) // If successful, track playFabId playFabId = loginTask.Result.Result.PlayFabId; // Needed for subsequent tests } if (PlayFabClientAPI.IsClientLoggedIn()) return; // Success, already logged in // If the setup failed to log in a user, we need to create one. var registerRequest = new ClientModels.RegisterPlayFabUserRequest(); registerRequest.TitleId = PlayFabSettings.TitleId; registerRequest.Username = USER_NAME; registerRequest.Email = USER_EMAIL; registerRequest.Password = USER_PASSWORD; var registerTask = PlayFabClientAPI.RegisterPlayFabUserAsync(registerRequest); registerTask.Wait(); UUnitAssert.NotNull(registerTask.Result); UUnitAssert.Null(registerTask.Result.Error); UUnitAssert.NotNull(registerTask.Result.Result); playFabId = registerTask.Result.Result.PlayFabId; // Needed for subsequent tests UUnitAssert.True(PlayFabClientAPI.IsClientLoggedIn(), "User login failed"); }
/// <summary> /// Signs the user into the PlayFab account, returning a session identifier that can subsequently be used for API calls which require an authenticated user /// </summary> public static void LoginWithEmailAddress(LoginWithEmailAddressRequest request, ProcessApiCallback<LoginResult> resultCallback, ErrorCallback errorCallback, object customData = null) { request.TitleId = request.TitleId ?? PlayFabSettings.TitleId; if (request.TitleId == null) throw new Exception("Must be have PlayFabSettings.TitleId set to call this method"); string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy); Action<CallRequestContainer> callback = delegate(CallRequestContainer requestContainer) { ResultContainer<LoginResult>.HandleResults(requestContainer, resultCallback, errorCallback, LoginWithEmailAddressResultAction); }; PlayFabHTTP.Post("/Client/LoginWithEmailAddress", serializedJson, null, null, callback, request, customData); }
public void LoginOrRegister() { if (!PlayFabClientAPI.IsClientLoggedIn()) // If we haven't already logged in... { var loginRequest = new LoginWithEmailAddressRequest(); loginRequest.Email = USER_EMAIL; loginRequest.Password = USER_PASSWORD; loginRequest.TitleId = PlayFabSettings.TitleId; PlayFabClientAPI.LoginWithEmailAddress(loginRequest, LoginCallback, SharedErrorCallback); WaitForApiCalls(); // We don't do any test here, because the user may not exist, and thus login might fail, but the test should not } if (PlayFabClientAPI.IsClientLoggedIn()) return; // Success, already logged in // If the setup failed to log in a user, we need to create one. var registerRequest = new RegisterPlayFabUserRequest(); registerRequest.TitleId = PlayFabSettings.TitleId; registerRequest.Username = USER_NAME; registerRequest.Email = USER_EMAIL; registerRequest.Password = USER_PASSWORD; PlayFabClientAPI.RegisterPlayFabUser(registerRequest, RegisterCallback, SharedErrorCallback); WaitForApiCalls(); UUnitAssert.StringEquals("User Registration Successful", lastReceivedMessage); // If we get here, we definitely registered a new user, and we definitely want to verify success UUnitAssert.True(PlayFabClientAPI.IsClientLoggedIn(), "User login failed"); }
public void InvalidLogin() { // If the setup failed to log in a user, we need to create one. var request = new LoginWithEmailAddressRequest(); request.TitleId = PlayFabSettings.TitleId; request.Email = USER_EMAIL; request.Password = USER_PASSWORD + "INVALID"; PlayFabClientAPI.LoginWithEmailAddress(request, LoginCallback, SharedErrorCallback); WaitForApiCalls(); UUnitAssert.False(lastReceivedMessage.ToLower().Contains("successful"), lastReceivedMessage); UUnitAssert.True(lastReceivedMessage.ToLower().Contains("password"), lastReceivedMessage); }
private static PlayFabClientAPI.LoginWithEmailAddressResponseCallback _onApiResponseStLogin = OnApiResponse_StLogin; // Static methods can be cast once and saved as a static variable private static void OnApiResponse_StLogin(string url, int callId, LoginWithEmailAddressRequest request, LoginResult result, PlayFabError error, object customData) { var delta = DateTime.UtcNow - CallTimes_StLogin[callId]; Debug.Log(url + " completed in " + delta.TotalMilliseconds + " - _StLogin"); CallTimes_StLogin.Remove(callId); }
private static PlayFabClientAPI.LoginWithEmailAddressRequestCallback _onApiRequestStLogin = OnApiRequest_StLogin; // Static methods can be cast once and saved as a static variable private static void OnApiRequest_StLogin(string url, int callId, LoginWithEmailAddressRequest request, object customData) { CallTimes_StLogin[callId] = DateTime.UtcNow; }
/// <summary> /// Signs the user into the PlayFab account, returning a session identifier that can subsequently be used for API calls which require an authenticated user /// </summary> public static async Task<PlayFabResult<LoginResult>> LoginWithEmailAddressAsync(LoginWithEmailAddressRequest request) { request.TitleId = PlayFabSettings.TitleId ?? request.TitleId; if(request.TitleId == null) throw new Exception ("Must be have PlayFabSettings.TitleId set to call this method"); object httpResult = await PlayFabHTTP.DoPost(PlayFabSettings.GetURL() + "/Client/LoginWithEmailAddress", request, null, null); if(httpResult is PlayFabError) { PlayFabError error = (PlayFabError)httpResult; if (PlayFabSettings.GlobalErrorHandler != null) PlayFabSettings.GlobalErrorHandler(error); return new PlayFabResult<LoginResult> { Error = error, }; } string resultRawJson = (string)httpResult; var serializer = JsonSerializer.Create(PlayFabSettings.JsonSettings); var resultData = serializer.Deserialize<PlayFabJsonSuccess<LoginResult>>(new JsonTextReader(new StringReader(resultRawJson))); LoginResult result = resultData.data; AuthKey = result.SessionTicket ?? AuthKey; return new PlayFabResult<LoginResult> { Result = result }; }
public void InvalidLogin(UUnitTestContext testContext) { // If the setup failed to log in a user, we need to create one. var request = new LoginWithEmailAddressRequest(); request.TitleId = PlayFabSettings.TitleId; request.Email = USER_EMAIL; request.Password = USER_PASSWORD + "INVALID"; PlayFabClientAPI.LoginWithEmailAddress(request, PlayFabUUnitUtils.ApiCallbackWrapper<LoginResult>(testContext, InvalidLoginCallback), PlayFabUUnitUtils.ApiErrorWrapper(testContext, ExpectedLoginErrorCallback), testContext); }
public void LoginWithAdvertisingId() { PlayFabSettings.AdvertisingIdType = PlayFabSettings.AD_TYPE_ANDROID_ID; PlayFabSettings.AdvertisingIdValue = "PlayFabTestId"; var loginRequest = new LoginWithEmailAddressRequest(); loginRequest.Email = USER_EMAIL; loginRequest.Password = USER_PASSWORD; loginRequest.TitleId = PlayFabSettings.TitleId; PlayFabClientAPI.LoginWithEmailAddress(loginRequest, LoginCallback, SharedErrorCallback); WaitForApiCalls(); UUnitAssert.StringEquals(PlayFabSettings.AD_TYPE_ANDROID_ID + "_Successful", PlayFabSettings.AdvertisingIdType); }
private void OnGUI () { GUI.Label (ResizeGUI(new Rect (10, 10, 500, 30)), PhotonNetwork.connectionStateDetailed.ToString ()); if (!PhotonNetwork.connected) networkState = NetworkStates.NotLoggedIn; else if (PhotonNetwork.room == null) networkState = NetworkStates.InLobby; else if (PhotonNetwork.room != null) networkState = NetworkStates.InRoom; else networkState = NetworkStates.Unknown; // Network state machine switch (networkState) { case NetworkStates.NotLoggedIn: { /* if (GUI.Button (new Rect (10, 10, 150, 70), "Login to Facebook")) { FB.Login ("email", LoginCallback); } */ if (hasError) { StartCoroutine("waitForError"); GUIStyle myStyle = new GUIStyle (); myStyle.fontSize = 36; GUI.Label (ResizeGUI(new Rect (10, 50, 200, 20)), myErrorMessage, myStyle); } username = GUI.TextField (ResizeGUI(new Rect (10, 100, 200, 20)), username); email = GUI.TextField (ResizeGUI(new Rect (10, 130, 200, 20)), email); password = GUI.PasswordField (ResizeGUI(new Rect (10, 160, 200, 20)), password, '*'); if (GUI.Button (ResizeGUI(new Rect (10, 210, 150, 30)), "Create Account")) { audioManager.playClick(); RegisterPlayFabUserRequest request = new RegisterPlayFabUserRequest (); request.TitleId = PlayFabSettings.TitleId; request.Username = username; request.Email = email; request.Password = password; PlayFabClientAPI.RegisterPlayFabUser (request, OnPlayFabRegisterSuccess, OnPlayFabError); } if (GUI.Button (ResizeGUI(new Rect (10, 250, 150, 30)), "Login with Username")) { audioManager.playClick(); LoginWithPlayFabRequest request = new LoginWithPlayFabRequest (); request.Username = username; request.Password = password; request.TitleId = PlayFabData.TitleId; PlayFabClientAPI.LoginWithPlayFab (request, OnPlayFabLoginSuccess, OnPlayFabError); } if (GUI.Button (ResizeGUI(new Rect (10, 290, 150, 30)), "Login with Email")) { audioManager.playClick(); LoginWithEmailAddressRequest request = new LoginWithEmailAddressRequest(); request.Email = email; request.Password = password; request.TitleId = PlayFabData.TitleId; PlayFabClientAPI.LoginWithEmailAddress(request, OnPlayFabLoginSuccess, OnPlayFabError); } break; } case NetworkStates.InLobby: { if (joinedRoom) { GameObject board = GameObject.Find("Board"); Destroy(board); audioManager.source.Stop(); audioManager.loopMenuMusic(); background.SetActive(true); title.SetActive(true); turnManager.currentPlayer = 0; // resets game when you leave turnManager.gameOver = false; turnManager.gameStarted = false; turnManager.movesPerTurn = 2; GameObject go = GameObject.FindGameObjectWithTag ("Canvas"); ActionMenu actionMenu = (ActionMenu)go.transform.FindChild ("ActionMenu(Clone)").GetComponent<ActionMenu>(); actionMenu.DestroyActionMenu(); joinedRoom = false; } inRoom = false; createRoomName = GUI.TextField (ResizeGUI(new Rect (10, 110, 150, 30)), createRoomName); // Create game button if (GUI.Button (ResizeGUI(new Rect (10, 50, 150, 50)), "Create Game")) { audioManager.playClick(); Debug.Log ("room name = " + createRoomName); PhotonNetwork.CreateRoom (createRoomName, true, true, 5); } // Join existing game button if (roomsList != null) { for (int i = 0; i < roomsList.Length; i++) { if (GUI.Button (ResizeGUI(new Rect (10, 180 + (80 * i), 150, 70)), "Join " + roomsList [i].name)) { audioManager.playClick(); PhotonNetwork.JoinRoom (roomsList [i].name); } } } break; } case NetworkStates.InRoom: // in room so instantiate player { inRoom = true; GUILayout.Label ("Your name: " + PhotonNetwork.playerName + " - " + playfabUserID ); GUILayout.Label (PhotonNetwork.playerList.Length + " players in this room."); GUILayout.Label ("The others are:"); foreach (PhotonPlayer player in PhotonNetwork.otherPlayers) { GUILayout.Label (player.ToString ()); } if (GUI.Button (ResizeGUI(new Rect (10, 70, 150, 30)), "Leave")) { audioManager.playClick(); PhotonNetwork.LeaveRoom (); } break; } case NetworkStates.Unknown: { GUILayout.Label ("Unknown network state!"); break; } } if (PhotonNetwork.connected && !inRoom) { if (GUI.Button (ResizeGUI(new Rect (10, Screen.height - 70, 150, 30)), "Logout")) { audioManager.playClick(); if (FB.IsLoggedIn) FB.Logout (); PhotonNetwork.Disconnect (); } } }