Hello,
I am trying to send an email to new users when they create an account so that confirm their email address before being able to login. I tried following the documentation, this one here specifically, but the code seems to be outdated.
I have a put a comment where I get the error. In the documentation it says AddOrUpdateContactEmailRequest only requires an email, which kind of makes the first function useless.
I still tried it and removed PlayFabId = playFabId, but it gave me this PlayFabError: claim was not allowed to perform the requested action based on the entity's access policy. Policy comment: By default, all requests are denied. If you expected this request to succeed, you may be missing a policy. See the permissions APIs in PlayFab's Admin Api to add a permission. I did set the CreateAccount to false and I put the players title ID in the Custom ID.
So I tried only using the second function directly instead of passing through the first one which gave me a PlayFabError HTTP/1.1 409 Conflict.
It seems I can't update the contact email and because my players don't have a contact email, I can't send them any kind of emails.
void AddContactEmailToPlayer() { var loginReq = new LoginWithCustomIDRequest { CustomId = "SomeCustomID", // replace with your own Custom ID CreateAccount = true // otherwise this will create an account with that ID }; var emailAddress = "testaddress@example.com"; // Set this to your own email PlayFabClientAPI.LoginWithCustomID(loginReq, loginRes => { Debug.Log("Successfully logged in player with PlayFabId: " + loginRes.PlayFabId); AddOrUpdateContactEmail(loginRes.PlayFabId, emailAddress); }, FailureCallback); } void AddOrUpdateContactEmail(string playFabId, string emailAddress) { var request = new AddOrUpdateContactEmailRequest { PlayFabId = playFabId, // This line here gives an error, so I removed it EmailAddress = emailAddress }; PlayFabClientAPI.AddOrUpdateContactEmail(request, result => { Debug.Log("The player's account has been updated with a contact email"); }, FailureCallback); } void FailureCallback(PlayFabError error) { Debug.LogWarning("Something went wrong with your API call. Here's some debug information:"); Debug.LogError(error.GenerateErrorReport()); }