Last active
April 3, 2017 21:51
-
-
Save anaselhajjaji/15208f410ed65311ce4ed3078ff42224 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button adalButton = FindViewById<Button>(Resource.Id.adalButton); | |
adalButton.Click += async (sender, args) => | |
{ | |
var authContext = new AuthenticationContext(commonAuthority); | |
if (authContext.TokenCache.ReadItems().Count() > 0) | |
{ | |
authContext = new AuthenticationContext(authContext.TokenCache.ReadItems().First().Authority); | |
} | |
authResult = await authContext.AcquireTokenAsync(graphResourceUri, clientId, returnUri, new PlatformParameters(this)); | |
if ((authResult != null) && !string.IsNullOrEmpty(authResult.AccessToken)) | |
{ | |
Toast.MakeText(this, string.Format("Welcome {0} {1}.", authResult.UserInfo.GivenName, | |
authResult.UserInfo.FamilyName), ToastLength.Long).Show(); | |
StartActivity(typeof(RememberListActivity)); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment