question

Paolo Moser avatar image
Paolo Moser asked

invalid input parameters - RegisterPlayFabuser

Hi everyone, I'm working on my first unity project, I'm trying to create a login panel but when i run the project I have this error:

"/Client/RegisterPlayFabUser: Invalid input parameters : One of the following properties must be defined: Password, EncryptedRequest"

what can cause this error? please help me!

using PlayFab;
using PlayFab.ClientModels;
using System;
using UnityEngine;


public class PlayFabController : MonoBehaviour
{
    private string userEmail;
    private string userPassword;
    private string username;
    public GameObject loginPanel;


    public void Start()
    {
        //Note: Setting title Id here can be skipped if you have set the value in Editor Extensions already.
        if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
        {
            PlayFabSettings.TitleId = "1****"; // Please change this value to your own titleId from PlayFab Game Manager
        }
        var request = new LoginWithEmailAddressRequest { Email = userEmail, Password = userPassword };
        PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSuccess, OnLoginFailure);
    }


    private void OnLoginSuccess(LoginResult result)
    {
        Debug.Log("Congratulations, you made your first successful API call!(loggato)");
        loginPanel.SetActive(false);
    }


    private void OnRegisterSuccess(RegisterPlayFabUserResult result)
    {
        Debug.Log("Congratulations, you made your first successful API call! (registrato)");
    }


    private void OnLoginFailure(PlayFabError error)
    {
        var registerRequest = new RegisterPlayFabUserRequest { Email = userEmail, Password = userPassword, Username = username };
        PlayFabClientAPI.RegisterPlayFabUser(registerRequest, OnRegisterSuccess, OnRegisterFailure);
    }
    private void OnRegisterFailure(PlayFabError error)
    {
        Debug.LogError(error.GenerateErrorReport());
    }




    public void getUserEmail(string s)
    {
        userEmail = s;
    }
    public void getUserPassword(string s)
    {
        userPassword = s;
    }
    public void getUsername(string s)
    {
        username = s;
    }
    public void OnClickLogin()
    {
        var request = new LoginWithEmailAddressRequest { Email = userEmail, Password = userPassword };
        PlayFabClientAPI.LoginWithEmailAddress(request, OnLoginSuccess, OnLoginFailure);
    }
}



10 |1200

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

1 Answer

·
Ivan Cai avatar image
Ivan Cai answered

The issue seems to be an error caused by not getting the password. The password is required if you are using username, email, or username+email. You can debug code to check whether the password is obtained.

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.