LogIn token to WebView (MSAL) Xamarin

落爺英雄遲暮 提交于 2020-01-06 05:41:07

问题


I'm building a xamarin form app and to login I use MSAL. In the application, I open a site that requieres the MSAL token, this site opens with webview, but when this webview is opened it doesn't login automatically. I open session at Login, I catch the token but I don´t know how forward this token to the web view.

Here is my code:

on button click, the app executes this function:

 private async void CampusButton_Clicked(object sender, EventArgs e)
        {
            await Navigation.PushModalAsync(new NavigationPage(new CampusVirtualPage()));
        }

Inside CampusVirtualPague I do this

<ContentPage.Content>
        <StackLayout>
            <Label x:Name="LoadingLabel" IsVisible="False" />
            <WebView x:Name="BrowserCV" WidthRequest="1000" HeightRequest="1000" 
                     Navigating="Browser_Navigating" Navigated="Browser_Navigated" />

        </StackLayout>
</ContentPage.Content>

This is the class for CampusVirtualPage:

  public CampusVirtualPage()
        {
            InitializeComponent();
            var msaltoken = (Application.Current as App).MsalToken;
            BrowserCV.Resources.ContainsKey(msaltoken);
            BrowserCV.Source = "https://www.fidelitasvirtual.org/moodle3/auth/oidc/";


        }

How can I share this token to webview the way this site will open automatically?

Sorry if English wasn't perfect. It's not my native language and thanks for any idea how can I do it.

来源:https://stackoverflow.com/questions/58828376/login-token-to-webview-msal-xamarin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!