Playfab and custom auth
Options
Manse
✭
Hi,
After seeing this post viewtopic.php?f=17&t=5630&p=21463&hilit=Custom+Authentication#p21650 and the tobias message I tried to integrate playfab with photon but i can't get the custom auth working i get this message :
"Custom Authentication failed 'either due to user-input or configuration or AuthParameter string format). Calling: OnCustomAuthenticationFailed()"
"Custom authentication deserialization failed: Invalid JSON primitive: ."
I do something wrong or its not possible for the moment to integrate playfab in photon custom auth?
After seeing this post viewtopic.php?f=17&t=5630&p=21463&hilit=Custom+Authentication#p21650 and the tobias message I tried to integrate playfab with photon but i can't get the custom auth working i get this message :
"Custom Authentication failed 'either due to user-input or configuration or AuthParameter string format). Calling: OnCustomAuthenticationFailed()"
"Custom authentication deserialization failed: Invalid JSON primitive: ."
I do something wrong or its not possible for the moment to integrate playfab in photon custom auth?
0
Comments
-
I don't know how to reproduce this yet.
It seems this is a client side log entry: "Custom authentication deserialization failed: Invalid JSON primitive: ."?
If so, you should check the logged call stack and also log out the operation result via .ToStringFull(). Then we can take a look at what we get from the server.
If it's a server issue, then please get us the http post parameters.0 -
Hi. Photon SDK for Unity updated from v 4.0.0.4 to 4.0.0.10, and the code for custom authentication updated as well. But Playfab examples haven't updated yet. Unfortunately I cannot implement custom authentication with Playfab now. I get an error: "Failed to parse token from request"
Here's my code (data.UserId is my playfab id, and data.Token is a Photon Token i received from Playfab GetPhotonAuthenticationToken method):
if (_photonClient.AuthValues == null)
{
Debug.Log("Connect to master server. UserId = " + data.UserId + ", Token = " + data.Token);
_photonClient.AuthValues = new AuthenticationValues() { AuthType = CustomAuthenticationType.Custom };
}
_photonClient.AuthValues.AddAuthParameter("username", data.UserId);
_photonClient.AuthValues.AddAuthParameter("token", data.Token);
_photonClient.ConnectToRegionMaster("US");0 -
Hi @Anatolii Landyshev,
try this : (removing null check and adding UserId field)Debug.Log("Connect to master server. UserId = " + data.UserId + ", Token = " + data.Token); _photonClient.AuthValues = new AuthenticationValues(); _photonClient.AuthValues.AuthType = CustomAuthenticationType.Custom; _photonClient.AuthValues.AddAuthParameter("username", data.UserId); _photonClient.AuthValues.AddAuthParameter("token", data.Token); _photonClient.AuthValues.UserId = data.UserId; _photonClient.ConnectToRegionMaster("US");
1 -
To all,
Please check :
- if you're using the correct Photon AppId from PlayFab Dashboard (GameManager -> Servers -> Photon)
- [not for PUN] that you're callingloadBlancingClient.Service()
orchatClient.Service()
.
- that the value of "username" query string parameter in authentication request URL should match the PlayFabId received upon successful login to your title.
- that the value of "token" query string parameter in authentication request URL should match the one gathered using GetPhotonAuthenticationToken
- thatAuthenticationValues.AuthType
is set toCustomAuthenticationType.Custom
.
- thatAuthenticationValues.UserId
is set to a value if the authentication response from the web service does not return one. Otherwise, it will get a pseudo-randomly generated one (GUID) (I'm not sure about Photon Chat).0 -
I'm trying this with photon chat but the server keeps returning an error.
http://puu.sh/jzV57/ebff5c439a.png
0 -
Dan MacDonald: That is another case.
Can you create a new topic and also provide some insight how we can reproduce this? Did you check the plain demos we have in our packages? Does it have the same issue?
We will check early next week.0 -
@JohnTube
Thanks, it worked!0