Sign In Register

How can we help you today?

Start a new topic
Answered

resetAuthTokens not working?

Hey, I'm new to Gamesparks (just switched from Parse.com).


I wanted to add a "log-out" function, yet every single time I restart my application it's already authenticated as my testing user. (I use authentication with name/pw)

As I haven't found any prebuilt LogOut-function I tried to create a cloud-function:


 

Spark.getPlayer().resetAuthTokens();

 yet not a single authtoken is removed from the list.


Then I added:

 

player.disconnect(true);

 and tested "false".


Even though it seemed to work in the test harness if I run the same script with my own application it is still able to authenticate after restarting.


Still even if I use player.disconnect(false) only the Authtoken of the current session seems to get removed.


Even though automatic authentication is a very nice feature that I will be using, I want to let the user decide whether or not he stays authenticated.


Thanks in advance :)


Best Answer
Hey Dominic,

Instead of logging the user out, would disconnecting Gamesparks on the client-side do the same job?
Then when you want to login, you can instead reconnect to Gamesparks and authenticate the user that the same time?

The problem with the resetTokens() call is that it immediately re-authenticates the user, so another token will be generated.

-Sean

Answer
Hey Dominic,

Instead of logging the user out, would disconnecting Gamesparks on the client-side do the same job?
Then when you want to login, you can instead reconnect to Gamesparks and authenticate the user that the same time?

The problem with the resetTokens() call is that it immediately re-authenticates the user, so another token will be generated.

-Sean

Hey Sean,


thank you for your answer. Since my last post I've moved on and changed my whole system because I've changed my mind about how I wanted thinks in my project.


Everything is working fine now as I'm using device authentication for the most part.


And I have to say I love GameSparks. Finally I can see progress when I want to instead of working on stuff no one will ever see anyways (networking).


So far the combination of GameSparks and LibGDX works flawless and fast. And it's easy to test stuff right away by just creating test-events.


So thank you guys for your work! You made mine easier! :D