Forum Libraries, Components, and Plugins


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Load SharePoint site-pages in Xamarin WebView with URL.

I am trying to load Sharepoint site pages in Xamarin WebView with URL like SharePoint Android/iOS app showing sitepages without asking user to log in at webview.

The app uses ADAL's AcquireTokenAsync() to get the access token from Azure AD and set the WebView source as SharePoint modern site pages URL. As the user first-time signs in to the app with AcquireTokenAsync(), the webview is load site page successfully.

After the user closes and relaunches the app, it uses AcquireTokenSilentAsync() to authenticate. But when the webview loading the site page with URL, Microsoft ask the user to log in again at webview.

After authentication with AcquireTokenSilentAsync(), there are some cookies missing in CookieManager and NSHttpCookieStorage.
I also tried with MSAL and the issue still persist.

Why there are cookies missing when the app using AcquireTokenSilentAsync(). How can achieve the goal without asking user to log in twice?

Here is some snapshot of code for authentication and webview.

    var platformParams = new PlatformParameters((Activity)Forms.Context);
    authResult = await authContext.AcquireTokenSilentAsync(resource, clientId);
    catch (Exception)
        authResult = await authContext.AcquireTokenAsync(resource, clientId, uri, platformParams);

var sitePageWebView = new WebView
    Source = "",
            MinimumHeightRequest = 1000,
            HorizontalOptions = LayoutOptions.FillAndExpand
Sign In or Register to comment.