Forum Scripting ArgumentException at Authenticate()

Post your problems and discussions relating to scripting in Unity here.

ArgumentException at Authenticate()

Postby Kikikan » July 29th, 2017, 4:49 pm

Hello,
I have problems with running this piece of code in Unity 2017.1.0b1 with the latest (Jun 19) SDK:
Code: Select all
public void Connect ()
    {
        PlayerIO.Authenticate([my_game_id],
            "public",
            new Dictionary<string, string> { { "username", usernameField.text },{ "password", passwordField.text } },
            null,
            (Client client) =>
            {
                Debug.Log("Successful Connection");
            },
            (PlayerIOError error) =>
            {
                Debug.Log(error.Message);
            });
    }


After running this piece of code by pressing a button, I get the following 2 errors:

System.ArgumentException: Cannot set Request Header host - name contains illegal characters or is not user-overridable
at UnityEngine.Networking.UnityWebRequest.SetRequestHeader (System.String name, System.String value) [0x00046] in C:\buildslave\unity\build\artifacts\generated\common\modules\UnityWebRequest\WebRequestBindings.gen.cs:473
at UnityEngine.WWW..ctor (System.String url, System.Byte[] postData, System.Collections.Generic.Dictionary`2 headers) [0x0006f] in C:\buildslave\unity\build\Runtime\WebRequestWWW\UWRWWW.cs:60
at PlayerIOClient.Internal.identifier126+identifier828.getRequest[identifier155] (Int32 method, identifier1059 args) [0x00000] in <filename unknown>:0
UnityEngine.Debug:LogError(Object)
PlayerIOClient.Internal.identifier828:getRequest(Int32, identifier1059)
PlayerIOClient.Internal.identifier830:MoveNext()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PlayerIOClient.Internal.identifier49:Enqueue(IEnumerator)
PlayerIOClient.Internal.identifier828:Call(Int32, identifier155, Callback`1, Callback`1)
PlayerIOClient.ChannelMonitor:Call(Int32, identifier155, Callback`1, Callback`1)
PlayerIOClient.Internal.identifier126:Authenticate(String, String, Dictionary`2, List`1, String, Dictionary`2, List`1, Callback`1, Callback`1)
PlayerIOClient.<>c__DisplayClass13:<Authenticate>b__f()
PlayerIOClient.PlayerIO:ensureInitialized(Callback)
PlayerIOClient.PlayerIO:Authenticate(String, String, Dictionary`2, String[], Callback`1, Callback`1)
Login:Connect() (at Assets/Scripts/Login.cs:20)
UnityEngine.EventSystems.EventSystem:Update()

ArgumentException: Cannot set Request Header host - name contains illegal characters or is not user-overridable
UnityEngine.Networking.UnityWebRequest.SetRequestHeader (System.String name, System.String value) (at C:/buildslave/unity/build/artifacts/generated/common/modules/UnityWebRequest/WebRequestBindings.gen.cs:473)
UnityEngine.WWW..ctor (System.String url, System.Byte[] postData, System.Collections.Generic.Dictionary`2 headers) (at C:/buildslave/unity/build/Runtime/WebRequestWWW/UWRWWW.cs:60)
PlayerIOClient.Internal.identifier126+identifier828.getRequest[identifier155] (Int32 method, identifier1059 args)
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
PlayerIOClient.Internal.identifier49:Enqueue(IEnumerator)
PlayerIOClient.Internal.identifier828:Call(Int32, identifier155, Callback`1, Callback`1)
PlayerIOClient.ChannelMonitor:Call(Int32, identifier155, Callback`1, Callback`1)
PlayerIOClient.Internal.identifier126:Authenticate(String, String, Dictionary`2, List`1, String, Dictionary`2, List`1, Callback`1, Callback`1)
PlayerIOClient.<>c__DisplayClass13:<Authenticate>b__f()
PlayerIOClient.PlayerIO:ensureInitialized(Callback)
PlayerIOClient.PlayerIO:Authenticate(String, String, Dictionary`2, String[], Callback`1, Callback`1)
Login:Connect() (at Assets/Scripts/Login.cs:20)
UnityEngine.EventSystems.EventSystem:Update()

If someone could help me, I'd appreciate it.
Thanks in advance.
Kikikan
 
Posts: 3
Joined: August 6th, 2016, 10:38 pm

Re: ArgumentException at Authenticate()

Postby Henrik » August 1st, 2017, 7:05 pm

Hey Kikikan,

Thanks for letting us know, we'll take a look at this and fix what they broke as soon as we can. :-)
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm


Return to Scripting