Forum General Can't connect

Any issues or discussions relating to Unity development are welcome here.

Can't connect

Postby dessaya » February 25th, 2013, 8:45 pm

For our Unity WebPlayer game, we have this piece of code that executes when the game starts:

Code: Select all
string user = "__anon__";
PlayerIO.Connect(gameId, "public", user, PlayerIO.CalcAuth(user, secret), null,
   (Client c) => { connectSuccessful(c); },
   (PlayerIOError e) => { Debug.LogError(e.Message); }
);


This works fine, except in one of our PCs, where we get this error in the log:

Code: Select all
InvalidAuth; The auth has expired, please reconnect


We tried running the game in different browsers, and even rebooting the PC, and we always get that same error.

What may be causing this error?
dessaya
 
Posts: 8
Joined: November 29th, 2011, 3:31 pm

Re: Can't connect

Postby Henrik » February 26th, 2013, 11:22 am

The system clock on that machine is probably set to the wrong date and time.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Can't connect

Postby Benjaminsen » February 26th, 2013, 3:03 pm

Henrik wrote:The system clock on that machine is probably set to the wrong date and time.


This exactly, make sure you have NTP enabled and your clock is synconized.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can't connect

Postby dessaya » February 26th, 2013, 8:25 pm

That worked, thanks!

Is there any workaround for this? I mean, I can't expect all our users to have NTP enabled :)
dessaya
 
Posts: 8
Joined: November 29th, 2011, 3:31 pm

Re: Can't connect

Postby Benjaminsen » February 26th, 2013, 8:46 pm

dessaya wrote:That worked, thanks!

Is there any workaround for this? I mean, I can't expect all our users to have NTP enabled :)


It's only a problem when testing towards the Development server as fare as I am aware.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can't connect

Postby dessaya » February 26th, 2013, 9:01 pm

I'm not using multiplayer code, so I can't be using the development server, right?

The code I pasted is the client connecting to the 'public' connection just to make a query to a BigDB table.
dessaya
 
Posts: 8
Joined: November 29th, 2011, 3:31 pm

Re: Can't connect

Postby Benjaminsen » February 26th, 2013, 9:10 pm

dessaya wrote:I'm not using multiplayer code, so I can't be using the development server, right?

The code I pasted is the client connecting to the 'public' connection just to make a query to a BigDB table.


I will have somebody look into that.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can't connect

Postby Benjaminsen » February 26th, 2013, 9:42 pm

My guys are pointing out that you are generating auth keys client side, which is why it fails.
You should NEVER generate auth keys in the client, auth keys should only ever be generated by a server as otherwise they are horribly insecure.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Can't connect

Postby dessaya » February 27th, 2013, 2:19 pm

You mean the CalcAuth() call, right? So I should uncheck the 'require authentication' option in the admin panel and remove the CalcAuth() call in the client?

Clearly I got it all wrong :oops:
Is this explained somewhere in the documentation? What is the use case for that option? Why is it insecure the way I was using it? It makes it easy to crack the shared secret?

Thanks again!
dessaya
 
Posts: 8
Joined: November 29th, 2011, 3:31 pm

Re: Can't connect

Postby Henrik » February 27th, 2013, 2:25 pm

The use-case for authentication om Connect is if you have an external userbase that your users authenticate towards, and you have a secure server where you can calculate the game authentication.

By putting the authentication calculation in the client, you also have to put the shared secret in the client, and since players have full access to that, they don't need to crack it, they can just read it straight up, which renders the whole feature useless.

What you probably want to use is SimpleUsers for QuickConnect, that way users can easily register and sign in, and you don't need to worry about password storage:

http://playerio.com/documentation/quick ... impleusers
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Can't connect

Postby dessaya » February 27th, 2013, 2:59 pm

Ok, that makes sense.
Thanks!
dessaya
 
Posts: 8
Joined: November 29th, 2011, 3:31 pm


Return to General



cron