Custom Authentication Error

Options

public void ConnectToPhoton(string s)

    {

        string userId = s;

        PhotonNetwork.AuthValues = new AuthenticationValues();

        PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom;

        if (s == "swat")

        {

            userId = PlayerPrefs.HasKey("user") ? PlayerPrefs.GetString("user") : "user" + Random.Range(0, 1000);

        }

        else

        {

            userId = "asdf";

        }

        PhotonNetwork.AuthValues.AddAuthParameter("token", userId);

        PhotonNetwork.ConnectUsingSettings(appVersion);

        PhotonNetwork.ConnectToRegion(CloudRegionCode.@in, appVersion);

    }
This is my code for custom Authentication and it works with my another Unity App successfully.
While working with my new game and I tried it the same way with same Authentication Url and Same Code but it fails with the error :

Operation failed: OperationResponse 230: ReturnCode: 32755 (aut failed). Parameters: {} Server: NameServer
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1705)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()


Custom Authentication failed (either due to user-input or configuration or AuthParameter string format). Calling: OnCustomAuthenticationFailed()
UnityEngine.Debug:LogError(Object)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1746)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:162)

As of now, I'm stuck for past two hours, any help would be appreciated. Thanks.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @swatatyarsa,

    Thank you for choosing Photon!

    If you call PhotonNetwork.ConnectUsingSettings(appVersion); then there is no need to call PhotonNetwork.ConnectToRegion(CloudRegionCode.@in, appVersion);. The first method call is enough to connect. If you want to set a region, set Hosting Type and Region from PhotonServerSettings.

    Using the same code could you just switch AppId and test: one with the old AppId and one with the new one?
    Also double-check custom authentication settings for each application.
    Keep in mind that custom authentication configuration changes may take a while to be applied.
    What does your web service receive and return? could you check the logs?