问题
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