You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 1, 2024. It is now read-only.
I am trying to use the Xamarin Forms WebView to open a Blazor website that is protected using MSAL and I need to set a custom header. From everything I read the best way to accomplish this was to use a custom WkWebViewRenderer. I went that route, and it works great on the Android side but not so well on the iOS side. On iOS the first time it fails, apparently when trying to authenticate or some combination of the custom header and the authentication but if I navigate away from the WebView page in the Xamarin iOS app and come back to it, it works as expected.
if (e.NewElement != null)
{
WKWebView wkWebView = this;
var headerKey = new NSString("Key");
var headerValue = new NSString("BR549");
var dictionary = new NSDictionary(headerKey, headerValue);
var webRequest = new NSMutableUrlRequest(wkWebView.Url);
webRequest.Headers = dictionary;
LoadRequest(webRequest);
}
}
}`
Is there something else I need to do on iOS WkWebViewRenderer to deal with the MSAL authentication from my Blazor web application?
Thank you in advance for any guidance.
The text was updated successfully, but these errors were encountered:
I am trying to use the Xamarin Forms WebView to open a Blazor website that is protected using MSAL and I need to set a custom header. From everything I read the best way to accomplish this was to use a custom WkWebViewRenderer. I went that route, and it works great on the Android side but not so well on the iOS side. On iOS the first time it fails, apparently when trying to authenticate or some combination of the custom header and the authentication but if I navigate away from the WebView page in the Xamarin iOS app and come back to it, it works as expected.
The custom renderer I am using is:
`public class HybridWebViewRenderer : WkWebViewRenderer
{
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
}`
Is there something else I need to do on iOS WkWebViewRenderer to deal with the MSAL authentication from my Blazor web application?
Thank you in advance for any guidance.
The text was updated successfully, but these errors were encountered: