question

robr84 avatar image
robr84 asked

User not found error when trying to create a game.

Hi,

When my game starts, I authenticate Playfab with Photon as per below script. This works fine. Then not long after I log into facebook as per below script. No issues here either and everything seems to be working correctly. But then when I go to create a game, I get the error:

OnCreateRoomFailed (Failed to create game on https:xxxxxxxxx/RoomCreated?:Error response ResultCode=2 Message=User not found. Any suggestions on what may be causing this error?

Thanks in advance!

	private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj) 
	{
		LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

	var customAuth = new AuthenticationValues { AuthType = CustomAuthenticationType.			Custom };

	customAuth.AddAuthParameter("username", _playFabPlayerIdCache);    // expected by PlayFab custom auth service

	customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);
	PhotonNetwork.AuthValues = customAuth;

	}



    private void OnFacebookLoggedIn()
    {
        // AccessToken class will have session details
        string aToken = AccessToken.CurrentAccessToken.TokenString;
        if (facebookAccessToken.gameObject.activeSelf)
        {
            facebookAccessToken.text = AccessToken.CurrentAccessToken.TokenString;
        }
        string facebookId = AccessToken.CurrentAccessToken.UserId;
        PhotonNetwork.AuthValues = new AuthenticationValues();
        PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Facebook;
        PhotonNetwork.AuthValues.UserId = facebookId; // alternatively set by server
        PhotonNetwork.AuthValues.AddAuthParameter("token", aToken);
        PhotonNetwork.ConnectUsingSettings();
    }

unity3dAuthenticationphotonwebhooks
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Seth Du avatar image Seth Du ♦ commented ·

May I ask are you finding players via Facebook ID? As PlayFab ID differs from Facebook ID, can you try PlayFab ID?

0 Likes 0 ·

1 Answer

·
Hamza Lazaar avatar image
Hamza Lazaar answered

Hi @rob84,

You need to choose either authenticate Photon clients with PlayFab or authenticate with facebook.

I recommend you login to PlayFab using facebook then authenticate Photon with PlayFab.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.