Facebook login for newbies

Hi, I would like to ask for some help in this matter. I'm developing a crossplatform game and I wanted to use facebook as a way for users to log in since I'm not used to server-side development and I wanted to avoid the struggle of creating my own authenticating system. So I started using photon turnbased and I've found creating/joining rooms without authentication really straight foward and easy. However, even though I want to allow random matchmaking, I want users to be able to send game requests to their friends. Then I followed this tutorial http://doc.exitgames.com/en/realtime/current/tutorials/custom-auth-facebook-javascript and got completely lost. I have my facebook app created, my photon app configured with the appid and secret, but I have no clue on what the step 3 in the tutorial means. Where am I suppoused to put that code? Am I supposed to have that code running in my own server?

As I understand, since in the dashboard you have a specific facebook configuration button, this login should be straigh forward, but I can't seem to manage it. I'm finding this really frustrating and I haven't found any solutions in this forum.

I would really appreciate the help.

Comments

  • Just to make sure we're on the same page: The Turnbased features are not yet available in Photon Unity Networking (PUN).
    I assume you use Unity.

    I am sorry to say, but we don't have a perfectly fitting tutorial for Custom Auth with Turnbased games yet. The closest sibling would be the PUN-based Custom Auth tutorial, which is also in Unity and C# based. It uses a slightly different API however. As example: The class "PhotonNetworking" is not available in the Turnbased API.

    Despite that, have a look at this Photon Unity Networking example:
    http://doc.exitgames.com/en/pun/current ... entication


    I think you almost got it, despite the JS demo.
    Section 3 is really about the client side but you won't find something similar in Unity. You will have to download and use the FB Plugin for Unity, to FB.Init() and then get a token from FB which you send to Photon.

    You set the Token in LoadBalancingClient.CustomAuthenticationValues before you connect to Photon. Like:

    [code2=csharp]LoadBalancingClient client; // create this as usual
    // after you connected FB and before you connect Photon do:

    client.CustomAuthenticationValues = new AuthenticationValues();
    client.CustomAuthenticationValues.AuthType = CustomAuthenticationType.Facebook;
    client.CustomAuthenticationValues.SetAuthParameters(FB.UserId, FB.AccessToken);

    // then connect[/code2]

    This should do the trick.
    You don't have to host anything yourself. It's just important to get the FB "AccessToken" and send it to Photon, which must be setup for Custom Authentication.
  • Hi Tobias,

    thank you very much for the quick reply, I missed that tutorial you just posted. This looks a lot more like what I had in mind.
  • I think we added it relatively recently and I'm also not happy with where it's placed.
    Which makes me even happier that you can make use of it :)
    Thanks for letting us know you make progress.