示例#1
0
        public App()
        {
            InitializeComponent();

            string bundleID    = "com.dominicsurrao.MSALTest"; // replace
            string clientID    = < Azure AD app registration client ID >;
            string tenantID    = < Azure AD tenant ID >;
            string redirectURI = "msauth." + bundleID + "://auth";

            string[] scopes = new string[] { "user.read" };

            mSALPublicClient = new MSALPublicClient(bundleID, clientID, tenantID,
                                                    redirectURI, scopes);

            MainPage = new MainPage();
        }
示例#2
0
        public MainPageViewModel()
        {
            _client = App.mSALPublicClient;

            LoginCommand = new Command(
                execute: async() =>
            {
                Username = await _client.Login();
            });

            LogoutCommand = new Command(
                execute: async() =>
            {
                await _client.Logout();

                Username = "";
            });
        }