Quantcast
Channel: Photon Server — Photon Engine
Viewing all articles
Browse latest Browse all 1557

Custom authentication UserID and NickName not Set

$
0
0
hi, i setuped photon server v4 in my own server. i red this article to configure Custom Authentication hosted in my own web server. but in PUN (v1.66) after connect, in the OnConnectedToMaster callback, i checked Nickname by PhotonNetwork.playerName but it has not value!

Codes:

1. in the Photon.LoadBalancing.dll.config in server:

<AuthSettings Enabled="true" ClientAuthenticationAllowAnonymous="false">
<AuthProviders>
<AuthProvider Name="MyWebSite"
AuthenticationType="0"
AuthUrl="http://MyWebSite.com/api/account/authenticate"/>
</AuthProviders>
</AuthSettings>
2. in the PUN in unity test client:

PhotonNetwork.AuthValues = new AuthenticationValues
{
AuthType = CustomAuthenticationType.Custom
};
PhotonNetwork.AuthValues.AddAuthParameter("userName", userName);
PhotonNetwork.AuthValues.AddAuthParameter("token", token);
PhotonNetwork.ConnectUsingSettings(Version);
...
public override void OnConnectedToMaster()
{
Debug.Log("UserId=" + PhotonNetwork.AuthValues.UserId+
", Nickname=" + PhotonNetwork.playerName);
}
3. in the response of authenticate service in MyWebServer:
{"ResultCode":1,"UserId":"foo@gmail.com","Nickname":"bar","Data":{"lvl":0}}

Expected Result:

in the PUN OnConnectedToMaster in result of Debug.Log:
UserId=foo@gmail.com, Nickname=bar

Incorrect Result:

but it logs:
UserId=, Nickname=

Sorry for my weak english ;)

Viewing all articles
Browse latest Browse all 1557

Trending Articles