As I’ve already written in my blog post from July 2012, there is now the SharePoint 2013 mobile client authentication object model which you can use to authenticate users of your mobile app against SharePoint 2013.
Here are some more details, so that you can easily integrate SharePoint into your apps.
The object model provides two classes called “Authenticator” and “ODataAuthenticator”.
Authenticator works with ClientContext and cannot be used across multiple URLs.
When you use ODataAuthenticator it works with DataServiceContext and you’ll get an additional property called “ResolvedUrl”:
Gets the URL that is used for communication to the server that is running SharePoint when an ODataAuthenticator is being used. This may be the URL published on the Unified Access Gateway (UAG) server or, if the AllowSmartRouting property is true, this may be the SharePoint intranet URL if it is reached first when theAuthenticate method is called
The following authentication methods are supported:
- Default: Windows Authentication
- FormsAuthentication: Represents forms-based authentication mode
- Anonymous: Represents anonymous access mode
- BrowserBasedAuthentication (old name) / MicrosoftOnline (new name): Represents Microsoft Office Forms Based Authentication (MSOFBA) mode
Also good to know:
- The user name and password cannot be hard-coded for SharePoint Online.The user will be prompted for logon credentials, while for on-premises installations you could hard-wire a password, so that the user would never have to authenticate.
- You can also use Federation Authentication and pass an ADFS authentication scheme like: “domain\user”, “password”
For Windows Phone developers, there are some code samples for SharePoint 2013 available in the Windows Phone Dev Center.
Unfortunately, however, the samples (even the ones from 3. Jan 13) are built against the Microsoft SharePoint SDK Preview for Windows Phone (published on 14. Aug 12), although the final version of the Microsoft SharePoint SDK for Windows Phone is available since 30. Oct 12. (Update: My colleague Heinrich Ulbricht has also tested it and can confirm the differences between the two SDK versions.)
So if the code samples won’t build and you receive the following error message…
The type or namespace name ‘Authenticator’ could not be found (are you missing a using directive or an assembly reference?)
…then here is what to do:
- Go to “References” > “Add reference…” and add the following DLL:
C:\Program Files (x86)\Microsoft SDKs\SharePoint\v15.0\Phone\v7.1\Libraries\Microsoft.SharePoint.Client.Phone.Auth.UI.dll