Single Sign On - Authentication

Options
markharoldr
edited March 2012 in Photon Server
Hello Everyone,

I checked up the games Uberstrike and King's bounty and saw that both utilizes the facebook platform to retrieve credentials for registration and authentication. I know that web apps like Facebook uses HTTP requests to retrieve information and generally store everything in a session.

With this, I would like to ask if it is possible to get a php web-application's (e.g. Drupal) session variables in Photon because we are planning to have a single sign on functionality in our game. If it is possible, how would I do it?

Yours,
Mark

Comments

  • Tobias
    Options
    I don't know in detail but I'd render the user's id into the page's javascript. From there it goes into Unity and in an authenticate operation.
  • How would you pass a session variable from a drupal generated page with javascript to unity? Is it safe?
  • Tobias ,

    Can you explain clearly the about rendering the user's id to javascript and then pass it to unity to authenticate? I'm a beginner with this things so hope you could help me out here.

    Yours,
    Mark
  • Tobias
    Options
    Hehe. I wish I could but I'd have to look it up, too. I know this is possible with Unity. Check their reference or forums.
  • This is exactly what I am looking for. Any chance someone knows how to do this? Can I get a reference to a website or forum that will show me how? I have some ideas but I want to know if there is a better way.
  • I have seen this page, but I am not sure what information to pass to unity. Just the username and because it is passed from the page to unity I can just assume the user is authenticated? I guess I could pass some other validating criteria like an IP address or something to confirm it's in the same session and from the right person.

    Am I thinking about this the right way or over thinking it?
  • You could have the page create a session with a login server (like a typical PHP session or something), then have the unity client pass the session id to the game server, and then have the game server verify that the session id is in the login server's database. I'm not sure how you'd do this without writing server-side code, but I suspect you could do it with a special game client that lives on your back end environment.
  • Tobias
    Options
    This would certainly require some server-side coding.
    The login should create some sort of session or token. After putting it into the html, passing it to the webplayer, it must be passed to Photon and there you need to verify it with the login-server to make sure the session is valid.
    Or: You could make sure the Unity webplayer is only available to players who logged in and thus can access the page it's on. Then you know this is verified and could just pass the name of the player to the webplayer so you could show it in-game.
  • Yes, that would surely be simpler. Sometimes I forget things are easier when you don't have to support four drastically different platforms :)