Forum C# Authenticate method example has a parse error

Authenticate method example has a parse error

Postby mechanicallyseparatedgames » September 8th, 2014, 6:14 am

The example code in the Authentication description under Backend Services (https://gamesnet.yahoo.com/documentation/services/authentication/) has a parse error.

The example code:

Code: Select all
PlayerIO.Authenticate(
    "[Enter your game id here]",            //Your game id
    "public",                               //Your connection id
    new Dictionary<string, string> {        //Authentication arguments
        { "userId", "MyUserName" },
    },
    new string[]() { "campaign:march10" }   //PlayerInsight segments
    delegate(Client client) {
        //Success!
    },
    delegate(PlayerIOError error) {
        //Error authenticating.
    }
);


Should have the new string line changed to:

Code: Select all
    new string[] { "campaign:march10" },   //PlayerInsight segments
mechanicallyseparatedgames
 
Posts: 18
Joined: June 18th, 2014, 6:24 am

Re: Authenticate method example has a parse error

Postby Henrik » September 8th, 2014, 6:02 pm

Thanks for pointing it out, I'm fixing it right now!
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: Authenticate method example has a parse error

Postby mechanicallyseparatedgames » September 8th, 2014, 8:56 pm

Thanks! Also, you probably wanted to show the code block as dense as possible to show it's simplicity, but I suggest changing the string "MyUserName" to a variable called "myUserID" and defining it above the authentication block for clarity. Like so:

Code: Select all
string myUserID = "MyUserName";

PlayerIO.Authenticate(
    "[Enter your game id here]",            //Your game id
    "public",                               //Your connection id
    new Dictionary<string, string> {        //Authentication arguments
        { "userId", myUserID },
    },
    new string[] { "campaign:march10" },   //PlayerInsight segments
    delegate(Client client) {
        //Success!
    },
    delegate(PlayerIOError error) {
        //Error authenticating.
    }
);
mechanicallyseparatedgames
 
Posts: 18
Joined: June 18th, 2014, 6:24 am


Return to C#