Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BetfairClient.Login fails with INVALID_USERNAME_OR_PASSWORD #14

Open
Stereocheck opened this issue Nov 14, 2016 · 0 comments
Open

BetfairClient.Login fails with INVALID_USERNAME_OR_PASSWORD #14

Stereocheck opened this issue Nov 14, 2016 · 0 comments

Comments

@Stereocheck
Copy link

Great work on the Library!

When I try do a non-interactive Login with BetfairClient.Login if fails with INVALID_USERNAME_OR_PASSWORD even though they are correct. Looking into this it seems the code for generating the post data does not correctly format the details as a URL formatted string. My password has several nonstandard characters in it which seem to be misinterpreted during login.

I replaced the following code:
string postData = string.Format("username={0}&password={1}", username, password);

with:

NameValueCollection outgoingQueryString = HttpUtility.ParseQueryString(String.Empty);
outgoingQueryString.Add("username", username);
outgoingQueryString.Add("password", password);
string postData = outgoingQueryString.ToString();

Which rectifies the problem and logs in successfully. There may be more succinct ways of achieving this but this worked for me.

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant