Legend

Forum

Unread topics or posts

Topic

Unread posts

Locked

Announcement

Forums > Developers

SSL Credentials in .Net and C#



AuthorMessage
jeremy

Posted: Feb 01, 2014
Score: 0



Hi,

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.
jeremy

Posted: Feb 01, 2014
Score: 0



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.
Jake

Toodledo Admin
Posted: Feb 03, 2014
Score: 0



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.

http://api.toodledo.com/3/code.php
You cannot reply yet


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



Toodledo Forums > Developers