question

admin-21 avatar image
admin-21 asked

Get Email Verification Status - issue

Hey!

I have a problem with getting email verification status, I made a script that should works cause in my opinion all is as should be but i'm getting error, please take a look on my code and tell me what's wrong there?

public void GetPlayerProfiles(string playFabId)
    {
        var request = new GetPlayerProfileRequest
        {
            PlayFabId = playFabId,


            


            ProfileConstraints = new PlayerProfileViewConstraints()
            {
                ShowContactEmailAddresses = true,




            }




        };


        
        PlayFabClientAPI.GetPlayerProfile(request, OnPlayerProfileGet, errorPlayerProfiel);


      


    }




    public void errorPlayerProfiel(PlayFabError error)
    {
        Debug.Log("error profile");


     
    }
    public void OnPlayerProfileGet(GetPlayerProfileResult result)
    {
       


        statusVerification = result.PlayerProfile.ContactEmailAddresses[0].VerificationStatus.ToString();
    }




   
    public void loginClicked()
    {










        var request = new LoginWithPlayFabRequest
        {


            Password = loginPassword.text,
            Username = loginID.text,


            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetUserAccountInfo = true,


            },


            


            TitleId = "FC293",


        };


      












         
            PlayFabClientAPI.LoginWithPlayFab(request, OnLoginSuccess, OnError);
        


    
    }


    public void OnLoginSuccess(LoginResult result)
    {




        playfabIDstring = result.PlayFabId;


        Debug.Log("success");
      


        GetPlayerProfiles(playfabIDstring);
    }
Player Data
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

·
Made Wang avatar image
Made Wang answered

There's nothing wrong with your code, but make sure the account has an email before getting the email verification status.

You can make some judgments before getting it, refer to the code below.

    public void Login()
    {
        PlayFabClientAPI.LoginWithEmailAddress(new LoginWithEmailAddressRequest
        {
            Email = "",
            Password = "",
            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetPlayerProfile = true,
                ProfileConstraints=new PlayerProfileViewConstraints
                {
                    ShowContactEmailAddresses=true
                }
            }
        }, OnLoginSuccess, OnLoginError);
    }


    private void OnLoginError(PlayFabError error)
    {
        Debug.LogError(error.GenerateErrorReport());
    }


    private void OnLoginSuccess(LoginResult result)
    {
        if(result.InfoResultPayload.PlayerProfile.ContactEmailAddresses.Count>0)
        {
            Debug.Log(result.InfoResultPayload.PlayerProfile.ContactEmailAddresses[0].VerificationStatus);
        }
        else
        {
            Debug.Log("no email");
        }
    }

5 comments
10 |1200

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

admin-21 avatar image admin-21 commented ·

I tried but I'm getting error like this:

I checked and player have contact email but I'm getting this error

0 Likes 0 ·
Made Wang avatar image Made Wang admin-21 commented ·

Sorry for not explaining in advance, if you want to get some profiles on the client side, you need to check what you want to get in Game Manager->Title settings->Client Profile Options. But for some privacy information, we recommend calling GetPlayerProfile in Azure Function Cloud Script.

1 Like 1 ·
Made Wang avatar image Made Wang admin-21 commented ·

Did you add the following code to the login function?

            InfoRequestParameters = new GetPlayerCombinedInfoRequestParams
            {
                GetPlayerProfile = true,
                ProfileConstraints=new PlayerProfileViewConstraints
                {
                    ShowContactEmailAddresses=true
                }
            }

0 Likes 0 ·
admin-21 avatar image admin-21 Made Wang commented ·

If I have "GetPlayerProfile = true" I can not log in. If I do not have that - I can log in but I'm getting error cause I want to get status of verified email from nowhere.

0 Likes 0 ·
Show more comments

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.