Custom Authentication with Facebook Error Fix

Options
I have recently decided to use Facebook authentication because i'm not able to use custom so some authentication is better then none at all. However i was following this tutorial:
http://doc.exitgames.com/zh-cn/pun/curr ... entication

and when I got to:
void OnLoggedIn()
{
    PhotonNetwork.AuthValues = new AuthenticationValues();
    PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Facebook;
    PhotonNetwork.AuthValues.SetAuthParameters(FB.UserId, FB.AccessToken);
    PhotonNetwork.ConnectUsingSettings("1.0");
}

it was giving me an error saying that this:
PhotonNetwork.AuthValues.SetAuthParameters

did not exist and i looked all over the api and could not find another way to make this work until i looked at the Custom Authentication demo and found the fix so for anyone that got stuck like myself this code works with the new versions of Photon:
void OnLoggedIn()
{
    PhotonNetwork.AuthValues = new AuthenticationValues();
    PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Facebook;
    PhotonNetwork.AuthValues.AddAuthParameter("username", FB.UserId);
    PhotonNetwork.AuthValues.AddAuthParameter("token", FB.AccessToken);
    PhotonNetwork.ConnectUsingSettings("1.0");
}

Atleast this seems like it works for me and i feel that the tutorial should really be updated, and i'm sure it will just might not have been able to get to it yet :) Anyway hope this helps!

Comments

  • Tobias
    Options
    Thanks for the feedback. You are right about those pages.
    I just updated the docs accordingly. That will be deployed asap.