[Unity]Check whether user is authenticated when opening game
S
Samuel Edwin
started a topic
almost 8 years ago
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
T
Tech Support
said
almost 8 years ago
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.
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.
S
Samuel Edwin
said
almost 8 years ago
Thank you for the clarification
D
Danny Negus
said
about 4 years ago
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
D
Danny Negus
said
about 4 years ago
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)
Samuel Edwin
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 :)
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.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstTech Support
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.
Samuel Edwin
Thank you for the clarification
Danny Negus
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
Danny Negus
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
}
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics