I am trying to link a Facebook account with an existing PlayFab account that has been previously created with LoginWithAndroidDeviceID.
However, when calling LinkFacebookAccount, instead of linking the existing Playfab account with the Facebook account, a new PlayFab account is created.
The code I am using to call LinkFacebookAccount is the following (I'm using Unity):
//Called from a in game button public void Log_to_FB() { FB.LogInWithReadPermissions(perms,AuthCallback); } private void AuthCallback (ILoginResult result) { if (FB.IsLoggedIn) { // AccessToken class will have session details var aToken = Facebook.Unity.AccessToken.CurrentAccessToken; //Send PlayFab LinkFacebookAccountRequest request var request = new LinkFacebookAccountRequest {AccessToken = aToken.TokenString} ; PlayFabClientAPI.LinkFacebookAccount(request, OnLinkWithFBSuccess, OnLinkWithFBFailure); } else { Debug.Log("User cancelled login"); } } private void OnLinkWithFBSuccess(LinkFacebookAccountResult result) { Debug.Log("Facebook account successfully linked"); } private void OnLinkWithFBFailure(PlayFabError error) { Debug.Log("Unable to link FB account"); }
I can't see what I am doing wrong.
I followed the tutorial for dealing with login and linking account at Tutorials & Guides.
Thanks for the help!