ForumsDevelopersSSL Credentials in .Net and C#

SSL Credentials in .Net and C#
Author Message

Posted: Feb 01, 2014
Score: 0 Reference

So I've started working on a basic app for myself that will help me manage some aspects of my Toodledo tasks. Everything was going smoothly up until the point that I needed to get the access and refresh tokens.

I have worked for about six hours straight trying every possibility that I can think of, but I'm consistently getting a 400 Bad Request error with the details usually a code about credentials not being in the header or body, even though I am passing all these parameters about every way I can.

Has anyone successfully made it past this in a C#/.Net application that can give me some tips? I'm amazed at how difficult I am finding this.

Posted: Feb 01, 2014
Score: 0 Reference
As tends to happen, I stumbled upon the solution right after posting. In case it helps anyone else, this is the credential method I managed to get to work.

CredentialCache credCache = new CredentialCache();
credCache.Add(new Uri(mainURL), "Basic", new NetworkCredential(basicAuthUsername, basicAuthPassword));
webReq.Credentials = credCache;
webReq.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(basicAuthUsernamePassword)));

The mainURL variable is just the token.php URL. The two basicAuth fields are the client ID and secret. The combined field is just those same two but together, like it would be in front of the URL. user:secret.

Hopefully that can help someone else.

Toodledo Founder
Posted: Feb 03, 2014
Score: 0 Reference
Thanks for posting your answer. I am sorry that it was a challenge. You may want to look and see if there are any .net Oauth2 libraries that you can use to speed up the development.

Also, the sample code that we provide in other languages may give you some clues.
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.