question

playdashapp avatar image
playdashapp asked

LinkFacebookAccount create a new account instead of linking to an existing PlayFab account

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!

Account Management
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

·
brendan avatar image
brendan answered

Actually, the link calls cannot create accounts - there's no code path that would do that. All they do is link the credentials for the account you're linking to the currently-signed-in PlayFab account. Can you please provide the Title ID and PayFab IDs, so that we can have a look?

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.