Silverlight app response from Twitter

Jan 17, 2014 at 11:46 AM
Hi Joe,
First of all a big thanks for the library, its an amazing work.
I just started using this Lib today & referring to the Silverlight Demo in the sample code.

If I supply my Consumer Secret & Key in SL example this is what is happening.
  1. App Starts & navigated to twitter API for authentication
  2. User authorizes the app
  3. Twitter initiates the callback back to the app.
  4. DoWebAuth gets called a second time & also the ProcessResponse method gets called again on the handler. At this point
private void ProcessResponse(HttpWebRequest req, HttpContext context)
    {
        using (WebResponse resp = req.GetResponse())
        {
...............
...............

Fails & I am sent back to completed call back where a message box with exception is shown. The exception is 400 Not Found.

I believe this could be an issue with my app settings on twitter? I tried allowing the app for twitter Login & the callback is set as a dummy callback to http://www.google.com because from what I understand this is the only way twitter identifies that the APP Type is Browser (Earlier there was an option to specify the App Type which now have been removed)

Any help/ guidance in right direction is really appreciated. Once again Thank you for this awesome Lib :)

Supreet
Coordinator
Jan 17, 2014 at 4:59 PM
Hi Supreet,

Silverlight requires a proxy because it can't communicate directly with an external site. There's a proxy in the download and you can place that in your web site root folder.

@JoeMayo
Jan 20, 2014 at 5:51 AM
Hi Joe,
Thanks for your response. Yes I've downloaded the proxy & its already there in the Web part of my application (Asp.Net Web Container that contains the Silverlight App).

In fact, the code I've mentioned above is from the same ashx handler file.

Please let me know in case I can provide any additional info that could help identify the issue.

Thanks Again :)
Supreet
Jan 21, 2014 at 5:38 AM
Here is a screenshot of the exception I am getting. As you can see the error is 401 in ProcessResponse method of ashx handler.

Twitter Response Exception

Hope this helps.
Thanks & Regards
Supreet
Jan 29, 2014 at 4:05 AM
Hi Joe,
Could you please look into this when you get some time. Thank you in advance :)
Coordinator
Jan 29, 2014 at 4:59 PM
Here's a link to the FAQ, which has a large section on how to solve 401 errors:

https://linqtotwitter.codeplex.com/wikipage?title=LINQ%20to%20Twitter%20FAQ&referringTitle=Documentation
Jan 30, 2014 at 6:17 AM
Hi Joe,
Thanks for the documentation I had a detailed look at it & made sure that I was following the guidelines mentioned in there.
Further exploring, I see that the fiddler shows a response 401.


Here is the query that's failing
GET http://localhost:47985/LinqToTwitterProxy.ashx?url=https://api.twitter.com/oauth/access_token HTTP/1.1

If I use the same query "https://api.twitter.com/oauth/access_token" on Twitter's API explorer I get a 401 there too saying "HTTP/1.1 401 API is secure. Needs security Credentials"

The returned response had this following error

<hash>
<error>The access_token method must be called with a request_token</error>
<request>/oauth/access_token</request>
</hash>

Clearly I am mistaking something here. The problem is this is the same observation even when I use your Silverlight Sample. I see the same response. Are we missing sending some critical information that the twitter API needs?

Just to reiterate here is the flow so far:
I call for Authentication,
My App navigates to Twiiter Auth page
I supply the proper credentials
Twitter sends a response back & ProcessResponse method in your handler (.ashx page) is called & this is where it all fails. This is the point where I have made a note of request-response in fiddler available above.

Any help is really appreciated.

Thanks
Supreet
Jan 30, 2014 at 6:26 AM
Hi Joe,
Just in case if it helps. Here is a link to your sample app that I am using.
Silverlight Demo APP

Looking forward for your reply.

Thanks & Regards
Supreet Tare