private void LoginWithAD() { LoginCore(async() => { var authContext = new AuthenticationContext(Constants.ADCredentials.CommonAuthority); var clientId = Constants.ADCredentials.ClientId; var redirectUri = Constants.ADCredentials.RedirectUri; if (clientId == "your-client-id" || redirectUri.AbsolutePath == "http://your-redirect-uri") { throw new Exception("Please update Constants.ADCredentials with the correct ClientId and RedirectUri for your application."); } var response = await authContext.AcquireTokenAsync("https://graph.windows.net", clientId, redirectUri, _adAuthenticator.Value.GetPlatformParameters()); return(Credentials.AzureAD(response.AccessToken)); }); }