title: Navigating from Platform Specific (UWP) PageRenderer and back to PCL Page
body: <ul>
  <li>I have a MainPage in PCL which then navigates to a Platform Specific
  Login Page on LoginButton Click Event</li>
  <li>The LoginPage is inherited from
  platform specific PageRenderer as it needs platform specific
  Authentication to Social Providers (Facebook, Google, Twitter,
  Microsoft, etc.)</li>
  <li>I am using Xamarin.Auth to do the authentication.</li>
  <li>Inside the OnElementChanged event of the LoginPage, it instantiates
  the OAuth2Authenticator object.</li>
  <li>Upon successful instantiation (based
  on provider and app details), it needs to call the UI of the specific
  provider.</li>
  <li>To do that, I call the auth.GetUI where auth is
  Xamarin.Auth.OAuth2Authenticator object.</li>
  </ul>
  
  <p>I have two questions:</p>
  
  <ol>
  <li>In UWP, how do I navigate to the provider login UI? More specifically, what is the equivalent in UWP of the following code snippets in iOS and Android? In iOS, the following code is used: 
  <code>PresentViewController(auth.GetUI(), true, null);</code> 
  where auth is Xamarin.Auth.OAuth2Authenticator object. 
  In Android the following is used: 
  <code>activity.StartActivity(auth.GetUI(activity));</code></li>
  </ol>
  
  <p>I am looking for the equivalent code in UWP. Please bear in mind that these calls are made from the LoginPage which is derived from Platform specific PageRenderer</p>
  
  <ol start="2">
  <li>How do I navigate back to my MainPage (which is in PCL) upon successful authentication?</li>
  </ol>
  
  <p>The code is based off of a sample from the following source:
  <a href="http://www.c-sharpcorner.com/article/oauth-login-authenticating-with-identity-provider-in-xamarin-forms/" rel="nofollow noreferrer">http://www.c-sharpcorner.com/article/oauth-login-authenticating-with-identity-provider-in-xamarin-forms/</a></p>
  
  <p>Here is my code for the LoginPage:</p>
  
  <pre><code>using System;
  using Valufy;
  using Xamarin.Forms.Platform.UWP;
  using System.ComponentModel;
  using Valufy.UWP;
  using Valufy.AuthConfiguration;
  using Xamarin.Forms;
  [assembly: ExportRenderer(typeof(ProviderLoginPage), typeof(LoginRenderer))]
  
  namespace Valufy.UWP
  {
  class LoginRenderer: PageRenderer
  {
  protected override void OnElementChanged (ElementChangedEventArgs&lt;Xamarin.Forms.Page&gt; e)
  {
      base.OnElementChanged(e);
  
      //Get and Assign ProviderName from ProviderLoginPage
      ProviderLoginPage loginPage = (ProviderLoginPage)Element;
      string providername = loginPage.ProviderName;
  
          //Create OauthProviderSetting class with Oauth Implementation .Refer Step 6
          OAuthProviderSetting oauth = new OAuthProviderSetting();
  
              Xamarin.Auth.OAuth2Authenticator auth = oauth.LoginWithProvider(providername);  
  
              // After facebook,google and all identity provider login completed 
              auth.Completed += Auth_Completed;
  
              Type page_type = auth.GetUI();
  //////THIS IS WHERE I AM STUCK...HOW DO I GO TO THE PROVIDER AUTH UI ////////////
  
  //this.Frame.Navigate(page_type, auth);
  //parentPage.Navigation.PushModalAsync(auth.GetUI());
  
              }
  
      }
  
      private void Auth_Completed(object sender, Xamarin.Auth.AuthenticatorCompletedEventArgs e)
      {
          if (e.IsAuthenticated)
          {
              OAuthConfig.User = new UserDetails();
              // Get and Save User Details 
              OAuthConfig.User.Token = e.Account.Properties["oauth_token"];
              OAuthConfig.User.TokenSecret = e.Account.Properties["oauth_token_secret"];
              OAuthConfig.User.TwitterId = e.Account.Properties["user_id"];
          OAuthConfig.User.ScreenName = e.Account.Properties["screen_name"];
  
  /////NOW, HOW GO I GO BACK TO THE CALLING PAGE IN PCL ///////////////////
  
      }
      else
      {
          // The user cancelled
  /////NOW, HOW GO I GO BACK TO THE CALLING PAGE IN PCL ///////////////////
  }
  }
  }
  }                
  </code></pre>