Skip to content

Instantly share code, notes, and snippets.

@neewy
Created July 12, 2017 14:57
Show Gist options
  • Save neewy/5acebcea2f1381634155922b365603ef to your computer and use it in GitHub Desktop.
Save neewy/5acebcea2f1381634155922b365603ef to your computer and use it in GitHub Desktop.
using System;
using Xamarin.Forms;
namespace AuthSample
{
public partial class AuthSamplePage : ContentPage
{
Xamarin.Auth.OAuth2Authenticator authenticator = null;
public AuthSamplePage()
{
InitializeComponent();
authenticator
= new Xamarin.Auth.OAuth2Authenticator
(
clientId: "wpf.webview.client",
authorizeUrl: new Uri("http://visiologyidentity.northeurope.cloudapp.azure.com:12406/connect/authorize"),
redirectUrl: new Uri("oob://localhost/wpf.webview.client/logout"),
scope: "openid profile roles",
getUsernameAsync: null,
isUsingNativeUI: false
)
{
AllowCancel = true,
};
NavigateLoginPage();
}
Xamarin.Auth.XamarinForms.AuthenticatorPage login_page = null ;
private void NavigateLoginPage()
{
authenticator.AccessTokenUrl = new Uri("http://visiologyidentity.northeurope.cloudapp.azure.com:12406/connect/token");
// / *
//---------------------------------------------------------------------
// ContentPage with CustomRenderers
login_page = new Xamarin.Auth.XamarinForms.AuthenticatorPage()
{
Authenticator = authenticator,
};
Navigation.PushModalAsync(login_page);
//---------------------------------------------------------------------
// Xamarin.UNiversity Team Presenters Concept
// Xamarin.Auth.Presenters.OAuthLoginPresenter presenter = null;
// presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter();
//presenter.Login (authenticator);
//---------------------------------------------------------------------
// * /
return;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment