Sign In Register

How can we help you today?

Start a new topic

Auto Login Using Facebook and GS

Hello,


I am starting to develope an online game using GameSparks for LoginManager and Database.


After an intensive research, the idea is to autologin at the start of the game following these steps:


1. Initial Register in GameSparks using DeviceAuthenticationRequest (to use if the user don¡t want/hasn't got FB Account.)

2. Auto Login FB if possible using Facebbok SDK, creating a new access token.

3. Link GameSparks with FB Login using Facebbok Connect Request (if the user has logged with FB)


After that, i want to get the User ID to save/load DataPlayer to/from him.


The problem is I am not really an expert so I need a guide to implement this, even i really don't know if the steps are corrects. The documentation is fragmented so i don't know how to link all the steps in code. Could someone help me? I'll aprecciate any suggestions.


Thanks in advance!


Regards, 


Raúl Campos 

1 Comment

Hi Raul,


For an automatic DeviceAuthentication you could use something like the following in your Start function.


 void Start()
    {
        if (GS.Available)
        {
                new GameSparks.Api.Requests.DeviceAuthenticationRequest().Send((response) =>
                {
                    if (!response.HasErrors)
                    {
                        Debug.Log(response);
                    }
                   
                });
            }
        }

  

Auto authenticating with Facebook isn't a great idea as some users will not be using it. It might be better to offer to link to Facebook manually or for the user to set a userName and password with a ChangeUserDetailsRequest. A DeviceAuthenticated account should be considered as a temporary one. Linking socially or adding the userName and password will make sure the player always has a way to log back into it.


Thanks,

Liam

Login to post a comment