Silverlight and the Authorization Header – OAuth

I discovered the other day that there are issues when using Silverlight and setting the Authorization header, the preferred method for sending the oauth parameters to a service.

http://oauth.net/core/1.0a/#consumer_req_param

Silverlight 3.0 does not however let you set the Authorization header.

Silverlight 4 and 5 will let you set the header, but will produce a rather generic exception “System.Security.SecurityException: Security error” if the endpoint does not have a clientaccesspolicy.xml – the cross domain policy defined by Microsoft for use with Silverlight. This file allows for more specific control over the access, and must explicitly allow the use of the Authorization header. Currently services such as Flickr and Twitter do not support the clientaccesspolicy file, only the Adobe crossdomain.xml file.

Silverlight will fall back on to using the crossdomain.xml file, so calls can be made. However it appears the same issue exists with this file too:

http://kb2.adobe.com/cps/403/kb403184.html

Tim Heuer has an article covering how Silverlight and the Client Access Policy file works.

http://timheuer.com/blog/archive/2010/04/23/silverlight-authorization-header-access.aspx

It isn’t clear whether Silverlight would work with a modified crossdomain.xml file that allowed the Authorization header, as Silverlight only supports a subset of the crossdomain.xml file specification (but I can’t find details on which subset).

Flickr.Net for Silverlight/Windows Phone 7

Just a quick note to say I’ve released the first version of the Flickr.Net library to support Silverlight (3.0 and 4.0) and the new Windows Phone 7 SDK.

The release can be downloaded from flickrnet.codeplex.com – use the FlickrNetSilverlight.dll file in the binary download.

The new asynchronous methods added for silverlight (as all network traffic is async in silverlight) are also included in the existing Flickr.Net API for .Net 2.0+

Examples and documentation to come in the near future.

Let me know if you have any feedback.

Silverlight and Monotouch with Flickr.Net

The Flickr.Net library has been getting a bit of love recently.

Monotouch

Firstly, it got mentioned on the dotnetrocks podcast a week or so ago, a talk with Chris Hardy about Monotouch.

Postcast: http://www.dotnetrocks.com/default.aspx?showNum=568 – Flickr.Net is mentioned about 31minutes in. You can also view Chris’s talk at the NDC conference here: http://streaming.ndc2010.no/tcs/?id=815EADB7-066D-4516-A70F-31EEFDFB1DE2 – he does a demo using the Flickr.Net library in Monotouch at about the 40minutes mark.

Follow chris on twitter here: http://twitter.com/chrisntr

Silverlight

Recently I’ve been trying to work out how best to convert the Flickr.Net library over to Silverlight. Unfortunately it’s not as easy as it sounds, because most of the methods the library uses to talk to Flickr are only available in their asynchronous versions in Silverlight, which means the entire stack has to be converted to an asynchronous pattern.

Anyway, I’m almost there in terms of deciding on a method to use (maybe that is worth another post later) but in the mean time there is a post on the Silverlight Show web site about using Silverlight and Flickr which I’m using as my inspiration – the sooner the article is out of date the better :)

http://www.silverlightshow.net/items/Uploading-and-geo-tagging-photos-on-Flickr-using-Silverlight-4-s-HttpWebRequest.aspx