Facebook login/friends

Hi,

I just created a Facebook App and I want Photon to use it to get all the users that have my game... Any tutorial or sample to make it work with ObjectiveC in iOS?

Thanks.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2016
    Hi @Rurouni,

    We are aware that the only tutorial available for Photon custom authentication with facebook is for JavaScript only. But the custom authentication documentation covers all of the basics.

    ExitGames provides facebook authentication out-of-box.
    1. You need to setup a facebook app.
    2. You need to configure custom authentication from Photon Dashboard for your application.
    (Parts 1 and 2 are the exact same ones in this tutorial.)

    3.a. You need to download and use facebook SDK to get facebook ID, token and facebook name (among other things).

    3.b. Please use the following client code to set the authentication values for facebook in Photon: (note: you currently need to explicitly #import "LoadBalancing-objc/inc/Enums/EGCustomAuthenticationType.h" for this code to work - we will fix this for future versions, so that in the future that import should already be done by EGLoadBalancingClient.h)
    EGMutableAuthenticationValues* authenticationValues = [EGMutableAuthenticationValues authenticationValues];
    authenticationValues.Type = EGCustomAuthenticationType_FACEBOOK;
    NSString* ID = @"facebookUserID"; // obtained using facebook SDK
    NSString* token = @"facebookToken"; // obtained using facebook SDK
    authenticationValues.Parameters = [NSString stringWithFormat:@"token=%@", token];
    authenticationValues.UserID = ID; 
    // authenticationValues.Data should not be set for facebook
    [mLoadBalancingClient connect:authenticationValues :@"facebookName"]; // obtained using facebook SDK
    To get facebook friends' Photon status (FriendInfo: online or not, in room or not, room name if any) you can pass an array of facebook IDs (facebook friends gathered using facebook SDK) to opFindFriends. However, you this does not tell you which friends have your app installed.