title: How do I get the facebook oath page to load in Xamarin Forms WebView
body: <p>I have the following Xamarin Forms view and I'm trying to load a web view for doing Facebook authentication. </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.Net.Http;
  using System.Threading.Tasks;
  using Xamarin.Forms;
  
  namespace TestApp
  {
      public partial class FacebookLoginView : ContentView
      {
          private string _fbAppId = "MY APP ID";
          private string _appName = "APP NAME";
  
          public TechPactLoginView()
          {
              InitializeComponent();
          }
  
          void Facebook_Login_Clicked(object sender, System.EventArgs e)
          {
  
              var apiRequest =
                  "https://www.facebook.com/dialog/oauth?client_id="
                  + _fbAppId
                  + "&amp;display=popup&amp;response_type=token&amp;redirect_uri=http://www.facebook.com/connect/login_success.html";
  
              var webView = new WebView
              {
                  Source = apiRequest,
                  HeightRequest = 1
              };
  
              webView.Navigated += WebViewOnNavigated;
  
              Content = webView;
  
          }
  
          private async void WebViewOnNavigated(object sender, WebNavigatedEventArgs e)
          {
  
              var accessToken = ExtractAccessTokenFromUrl(e.Url);
  
              if (accessToken != "")
              {
                  await GetFacebookProfileAsync(accessToken);
  
              }
          }
  
          private string ExtractAccessTokenFromUrl(string url)
          {
              if (url.Contains("access_token") &amp;&amp; url.Contains("&amp;expires_in="))
              {
                  var at = url.Replace("https://www.facebook.com/connect/login_success.html#access_token=", "");
  
                  if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.Windows)
                  {
                      at = url.Replace("http://www.facebook.com/connect/login_success.html#access_token=", "");
                  }
  
                  var accessToken = at.Remove(at.IndexOf("&amp;expires_in="));
  
                  return accessToken;
              }
  
              return string.Empty;
          }
  
          public async Task GetFacebookProfileAsync(string accessToken)
          {
              var requestUrl = "https://graph.facebook.com/v2.7/me"
                  + "?fields=name,picture,cover,age_range,devices,email,gender,is_verified"
                  + "&amp;access_token=" + accessToken;
  
              var httpClient = new HttpClient();
              var userJson = await httpClient.GetStringAsync(requestUrl);
              Debug.WriteLine("profile json : {0}", userJson);
          }
      }
  }
  </code></pre>
  
  <p>I've added the following to my plist file in the iOS project</p>
  
  <pre><code>&lt;key&gt;NSAppTransportSecurity&lt;/key&gt;
      &lt;dict&gt;
          &lt;key&gt;NSExceptionDomains&lt;/key&gt;
          &lt;dict&gt;
              &lt;key&gt;facebook.com&lt;/key&gt;
              &lt;dict&gt;
                  &lt;!--Include to allow subdomains--&gt;
                  &lt;key&gt;NSIncludesSubdomains&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;!--Include to allow HTTP requests--&gt;
                  &lt;key&gt;NSTemporaryExceptionAllowsInsecureHTTPLoads&lt;/key&gt;
                  &lt;true/&gt;
                  &lt;!--Include to specify minimum TLS version--&gt;
                  &lt;key&gt;NSTemporaryExceptionMinimumTLSVersion&lt;/key&gt;
                  &lt;string&gt;TLSv1.1&lt;/string&gt;
              &lt;/dict&gt;
          &lt;/dict&gt;
      &lt;/dict&gt;
  </code></pre>
  
  <p>When the web view loads I still get an error saying that I need to add the apps domains.</p>
  
  <p><a href="https://i.stack.imgur.com/PR8QQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PR8QQ.png" alt="enter image description here"></a></p>