Sign In Register

How can we help you today?

Start a new topic
Solved

On Facebook connect player creation

Follow steps:

1 Auth with device: player will be created, it's OK

2 Connect Facebook: new player will be created O_O

Parameter "doNotLinkToCurrentPlayer" is setted to "false"

I revert my project to the time when everything worked ok, but problem still exists

It means a bug on the server side

i'm using Unity3d SDK

The code is something like this:
public class UserProfile : MonoBehaviour {
    [System.NonSerialized] public string cloudUserId = "";
    [System.NonSerialized] public bool isFacebookUser = false, isTwitterUser = false;
    [System.NonSerialized] public string accessTokenFacebook = "";

    bool _gsStartAuthorize = false;
    void Awake(){
        ProfileEvents.OnLoginFinished += SoomlaLoginReciever;
    }
    void SoomlaLoginReciever(Soomla.Profile.UserProfile UserProfile, string payload){
        if (SoomlaProfile.IsLoggedIn(Provider.FACEBOOK)) {
            accessTokenFacebook = FB.AccessToken;
            LoginWithFacebook();
        }
        if (SoomlaProfile.IsLoggedIn(Provider.TWITTER)) {
            isTwitterUser = true;
        }
    }
    void Update(){
        if (!_gsStartAuthorize && GS.Available){
            _gsStartAuthorize = true;
            AuthInit();
        }
    }
    void AuthInit(){
        if (isFacebookUser){
            LoginWithFacebook();
        }
        else {
            DeviceAuth();
        }
    }
    void LoginWithFacebook(){
        if (accessTokenFacebook == ""){return;}
        new FacebookConnectRequest().SetAccessToken(accessTokenFacebook).Send((response) => {
            if (response.HasErrors){
                isFacebookUser = false;
                Debug.LogError("Acces token is OOOOLD");
                accessTokenFacebook = "";
                DeviceAuth();
            }
            else {
                isFacebookUser = true;
            }
        });
    }
    void DeviceAuth(){
        new DeviceAuthenticationRequest().Send((response) => {
        });
    }
    public void Login(Provider provider){
        SoomlaProfile.Login(
            provider,
            "",
            new BadgeReward("loggedIn", "Logged In!")
        );
    }
}

 


Ahh, i'm forgot about clearing externalAuthentication collection during testing

Now all works perfect, i beg your pardon

Wait what? I'm having the same issue, what do you mean clear the "externalAuthentication"? Why would you have to clear that if there's nothing connected in the first place?

 "externalAuthentications": {},

My player has 0 external authentications, but whenever I post, it creates a new FB account. How did you resolve this? My doNotLinkToCurrentPlayer is false.

Login to post a comment