Omicron Llama

Coding all day, every day.

SharePoint Forms Authentication (FBA) with Apple iOS

Over on my Github project I have finally got round to doing some updates to the code. I’ve added a class that simplifies Forms Authentication, and allows you to issue the same REST API queries against SharePoint.

Code samples are on the wiki on the Github site.

Doing this wasn’t really that difficult, you basically execute a SOAP operation on /_vti_bin/authentication.asmx – calling the ‘Login’ operation. The envelope payload you pass in isn’t complex, just the username and password structured in the required XML (to see details of that, just visit the asmx url on any SharePoint Farm then click ‘Login’ to view the signature and response format. Once your request with a valid payload is completed, and if you’re authenticated, you get a response which contains your FedAuth cookie. Just keep a hold of that, add it to every other request to the site and you’re effectively logged in. Simple!

I’ve also modified the SPRESTQuery class to allow you to specify the SOAPAction and payload, which effectively lets you execute the classic ASMX web services – and thus makes it work with SharePoint 2010. Because of this, I’m thinking of renaming the project and refactoring a lot of the code to make a simple ‘SharePoint Connectivity Library for iOS’. Not sure when I’ll get round to doing this but hopefully sooner rather than later (it’s been 5 months since I started this project and made the first batch of code commits!). So, as I say on the README, ‘watch this space‘.

In summary of what I envisage the project/library to end up as – a helper class which will let you authenticate into SharePoint, persist the authentication cookies to keep you ‘logged in’, and to help you issue remote requests to the available client-side APIs (specifically, ASMX web servies and the REST API in 2013).

It currently doesn’t support NTLM, but this is something I do plan to include at some point.

Leave a Reply

Your email address will not be published. Required fields are marked *