question

uvisc avatar image
uvisc asked

PlayFab Unity Login With Email working fine when hardcoded string but not from Unity Text

Hi Everyone , looking for some help .

I am working on a game with PlayFab Integration . This is regarding the LoginWithEmail .

Registration is working fine but apparently when I try to login with email , It is saying User not found when I try and extract the text from the text box .

When I hard code the value , it is fine and I am able to login .

publicvoidOnEmailLogin()
{

//LoginWithPlayFabRequest loginRequest = new LoginWithPlayFabRequest();
varloginWithEmailRequest=newLoginWithEmailAddressRequest();

// Debug.Log("LoginEmail.transform.GetChild(2).gameObject 1" + LoginEmail.transform.GetChild(3).gameObject.name);
// Debug.Log("LoginEmail.transform.GetChild(2).gameObject 2" + LoginEmail.transform.GetChild(3).gameObject.transform.GetChild(1).name);
Debug.Log("Email :::"+LoginEmail.transform.GetChild(3).gameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text);
Debug.Log("Password :::"+LoginPassword.transform.GetChild(3).gameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text);

stringInputUserEmail=LoginEmail.transform.GetChild(3).gameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text;

//string InputUserEmail = LoginEmail.GetComponent("")
stringInputPassword=LoginPassword.transform.GetChild(3).gameObject.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text;
loginWithEmailRequest.TitleId="2050A";


Debug.Log("Login User Name Before var:"+InputUserEmail);
Debug.Log("Login Password Before var:"+InputPassword);

loginWithEmailRequest.Email=InputUserEmail;
loginWithEmailRequest.Password=InputPassword;
//loginRequest.Username = "saurovrc";


// Hard Coded Value.
//loginWithEmailRequest.Email = "saurovrc@gmail.com";
//loginWithEmailRequest.Password = "ABC@12345678";

Debug.Log("Login User Name after :"+loginWithEmailRequest.Email);
Debug.Log("Login Password after:"+loginWithEmailRequest.Password);
//Debug.Log("Login Request:" + LoginWithEmailAddressRequest.ToString());
Debug.Log("Login Request:"+loginWithEmailRequest.ToJson());

PlayFabClientAPI.LoginWithEmailAddress(loginWithEmailRequest,result=>{
Debug.Log("Logged IN with Email");
SceneManager.LoadScene("Main");

},error=>{

Debug.LogError(error.GenerateErrorReport());
Debug.LogError(error.ErrorDetails);
Debug.LogError(error.HttpCode);
Debug.LogError(error.ApiEndpoint);
//Debug.LogError(loginWithEmailRequest.ToString());
Debug.LogError(loginWithEmailRequest.ToJson());
});

Getting the error from Unity

Client/LoginWithEmailAddress: User not found UnityEngine.Debug:LogError(Object)

Login Request:{"Email":"saurovrc@gmail.com","InfoRequestParameters":null,"Password":"ABC@12345678","TitleId":"2050A","AuthenticationContext":null} UnityEngine.Debug:Log(Object)

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

I believe you need to output the email and password (from input text) in the console for debugging. You may also consider using trim() to eliminate the blank spaces or using Regex to delete any other invisible characters, for example, tab, linefeed and carriage return.

0 Likes 0 ·

1 Answer

·
uvisc avatar image
uvisc answered

Hi Seth ,

Thanks a lot , I ll try to use a trim and see if it works .

The output from the input text seems exactly same as the hardcoded value.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.