Sign In Register

How can we help you today?

Start a new topic
Answered

[Unity]Check whether user is authenticated when opening game

Hi guys,


I need to know if the user has been authenticated when opening the game, even with the anonymous device authentication, so I know when to display the login screen. I can't use GS.Authenticated since the connection has to be online in order for it to be true. The only alternative I can find is to check whether GS.GSPlatform.AuthToken is null or not, and this works. My question is, will the AuthToken ever expires or will it always be the same for the user? If yes, then I might face problems in the future and need another workaround.


Thanks :)


Best Answer

If GS.GSPlatform.AuthToken is not empty then the player has logged in at least once.


You could use this while offline, and use GS.Authenticated when online.


Answer

If GS.GSPlatform.AuthToken is not empty then the player has logged in at least once.


You could use this while offline, and use GS.Authenticated when online.

Thank you for the clarification

I've been trying to do this also but I don't understand how I use GS.GSPlatform.AuthToken, has this API been changed or something? Thanks

I have now found this, For anyone else who struggled to find it, it is located in the GameSparks.Core namespace. So I believe, the above code would be:


        if (GameSparks.Core.GS.GSPlatform.AuthToken != null)

        {

            // player has never logged in

        }



Login to post a comment