locked
Issue in SharePoint Online Authentication for Windows Phone 8.1 Application

    Question

  • I am using the SharePoint Online Client Components (as in below link) to authenticate SharePoint in my Windows Phone 8.1 Application.

    http://www.microsoft.com/en-us/download/details.aspx?id=42038

    When I try to run my Windows Phone 8.1 Application on Windows Phone Emulator, Authentication works like a charm. But when I deploy the same application to a Windows Phone 8.1 device and try to authenticate SharePoint, I get the following exception:

    "Identity Client Runtime Library (IDCRL) encountered an error while talking to the partner STS.".

    Note: I am using the following three DLLs

    • Microsoft.SharePoint.Client.Portable.dll
    • Microsoft.SharePoint.Client.Runtime.Portable.dll
    • Microsoft.SharePoint.Client.Runtime.WindowsPhone.dll

    I can NOT use the following two DLLs because there is no option to use SecureString class in Window Phone 8.1 Application, which is consumed by SharePointOnlineCredentials class constructor as one of the parameter. It's anyhow not present in System.Security namespace.

    • Microsoft.SharePoint.Client.dll
    • Microsoft.SharePoint.Client.Runtime.dll

    Please suggest me something. :-(

    Code as follows:

    public static void setContext(string SharePointWebUrl)
            {            
                using (Microsoft.SharePoint.Client.ClientContext _context = new ClientContext(SharePointWebUrl))
                {
                    try
                    {
                        var onlineCredentials = new SharePointOnlineCredentials(UserName, Password);

                        _context.Credentials = onlineCredentials;
                        _context.AuthenticationMode = ClientAuthenticationMode.Default;                    

                        _web = _context.Web;
                        _site = _context.Site;
                        _context.Load(_web);
                        _context.Load(_site);
                        _context.ExecuteQueryAsync();

                        Utility.isAuthenticated = true;
                    }
                    catch(Exception ex1)
                    {
                        Utility.isAuthenticated = false;   
                    }
                }
            }


    Friday, October 3, 2014 11:12 AM

Answers

  • ARM = the processor on which Windows phones run.
    x86 = the processor on which Windows emulators run.

    If the dll isn't compiled for ARM, then it's not going to work on the phone.  This would be an issue you would want to bring up on the SharePoint forums.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, October 6, 2014 6:51 PM
    Moderator

All replies

  • Are you sure that the DLL is supported for ARM?  Emulator runs on x86.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, October 6, 2014 12:29 PM
    Moderator
  • I have downloaded Windows Phone 8.1 SDK and running it on a Windows 8 Virtual Machine.

    I have used Visual Studio 2013 to develop my Windows Phone 8.1 application. Being a beginner in the development of mobile apps, sorry, I have no idea, what is ARM??

    However, I can only assure you that the application is perfectly running on Windows Phone "Emulator 8.1 WVGA 4 inch 512MB".

    When I deploy the same application to a device, the application deploys successfully. But when I try to login to my application (login page in my application which uses SharePointCredentials class to authenticate a SharePoint Online site), it fails, throwing the below exception:

    "Identity Client Runtime Library (IDCRL) encountered an error while talking to the partner STS."

    My SharePoint Online site is synced with Active Directory. However, I tried creating a dummy User Profile directly on cloud and try to authenticate with that User Profile. It worked fine both on device and emulator.

    So, I feel it is more of an ADFS authentication issue in Windows Phone 8.1

    I found a similar forum question on MSDN as below:

    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/73c2d14d-bb80-43b4-83f4-ab0f093efc4c/adfs-authentication-issue-on-windows-phone-81?forum=azuremobile

    But, the solution suggested there is for Windows Server 2012 ADFS and is not worth to disable Device authentication.

    I have Windows Server 2008 R2 Server for ADFS.

    Could you help me suggesting some solution for ADFS authentication in Windows Phone 8.1, where ADFS is on Windows Sevrer 2008 R2. Solution must not affect other services dealing with ADFS.

    Thanks a lot for you reply and help.

    Monday, October 6, 2014 3:31 PM
  • ARM = the processor on which Windows phones run.
    x86 = the processor on which Windows emulators run.

    If the dll isn't compiled for ARM, then it's not going to work on the phone.  This would be an issue you would want to bring up on the SharePoint forums.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, October 6, 2014 6:51 PM
    Moderator
  • Sorry, but it's not a SharePoint issue, but an ADFS authentication issue in Windows Phone 8.1 Apps.

    Hence, I am continuing further on the forum question below:

    http://social.msdn.microsoft.com/Forums/windowsapps/en-US/73c2d14d-bb80-43b4-83f4-ab0f093efc4c/adfs-authentication-issue-on-windows-phone-81?forum=azuremobile

    It's more relevant to my issue.

    Thanks.

    Tuesday, October 7, 2014 8:13 AM