Authenticating against SharePoint 2013 (Office365) using a live.com account

Hi -

I have some code based on the Microsoft.SharePoint.Client (v16)  that can authenticate against my Office365 SharePoint site when I use a domain that is registered with my account.  The great thing about SharePoint Online, you can invite others to your SharePoint website that don't have an account on the domain where the SP site is located.  I've invited my Microsoft live.com account to a SharePoint site to test how to authenticate a user from a different domain (i.e. live.com).  However, I'm getting the error:

Identity Client Runtime Library (IDCRL) could not lookup the realm information for the federated sign-in.

When you log into the Office365 using a web client, you cannot use the same flow for the live.com account that you can use for the domain account - There is a separate link "Using a Microsoft.Live account, login here" underneath the Office365 username and password boxes.  So the website is using some 'special' process for non Office365 accounts.

Like I said, the code works when using an account from the same domain where the SharePoint account is hosted, e.g. chris@mydomain.com where SharePoint is located at https://mydomain.sharepoint.com.  But when I try to use the live.com account (which has been registered at the SharePoint site via the Invite workflow) I cannot authenticate that account.

Here's the authentication code:

strTrace = "Establish the HTTPS context."
_clientContext = New ClientContext(_serverRootAddress)

strTrace = "Submit the credentials for SP2013."
Dim securePassword As SecureString = New SecureString
For i = 0 To _password.Length - 1
   securePassword.AppendChar(_password(i))
Next

Dim creds As New SharePointOnlineCredentials(Username, securePassword)

strTrace = "Connect to the site."
_mySite = _clientContext.Web

_clientContext.Load(_mySite)
_clientContext.ExecuteQuery()

Any insight would be appreciated - I've been working on this for a couple of weeks and can't quite find the secret recipe.

Thx
Chris

June 18th, 2015 1:15am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics