C# 针对Windows Phone 8.1问题的ADAL

C# 针对Windows Phone 8.1问题的ADAL,c#,azure,windows-phone-8.1,adal,C#,Azure,Windows Phone 8.1,Adal,我正在创建一个Windows Phone 8.1应用程序(Windows运行时),该应用程序需要针对Azure Active Directory OAuth端点进行身份验证。我使用ADAL for WP81 nuget包作为身份验证管理器来获取OAuth令牌 我正在努力解决的问题是,我需要调用电话页面生命周期中的各种ADAL登录方法。现在我正在调用页面中的AuthenticationContext.aquiretokeandcontine()。Loaded事件。我还实现了github示例代码中描

我正在创建一个Windows Phone 8.1应用程序(Windows运行时),该应用程序需要针对Azure Active Directory OAuth端点进行身份验证。我使用ADAL for WP81 nuget包作为身份验证管理器来获取OAuth令牌

我正在努力解决的问题是,我需要调用电话页面生命周期中的各种ADAL登录方法。现在我正在调用
页面中的
AuthenticationContext.aquiretokeandcontine()
。Loaded
事件。我还实现了github示例代码中描述的
ContinuationManager
IWebAuthenticationContinuable
、和
App.Activated
事件。我还使用
Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri()
获取我的客户端URI

无论我做什么,我都会继续得到以下错误。对我能做什么有什么见解吗?提前感谢您的帮助

'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException' 在mscorlib.ni.dll中发生,但未在用户代码中处理

其他信息:身份验证失败:基于浏览器 身份验证对话框未能完成


ADAL使用WebAUthenticationBroker(WAB)显示其提示。Windows Phone 8.1中的WAB在应用程序的整个UX加载之前不会显示,因此您当前的方法位置将不起作用-至少在WAB行为不变之前是如此。请参阅以获取类似的线程。

运行示例时是否会出现相同的错误?这可能是一个好的起点。如果没有错误,你应该检查你在应用程序中的不同做法。
async void MainPage_Loaded(object sender, RoutedEventArgs e)
{

        await LoadFromViewModel();
}

public async Task LoadFromViewModel()
{
 // Try to get a token without triggering any user prompt. 
 // ADAL will check whether the requested token is in the cache or can be obtained without user itneraction (e.g. via a refresh token).
    AuthenticationResult result = await authContext.AcquireTokenSilentAsync(this.viewModel.RESTApiResourceUri, this.viewModel.AzureADClientId);
    if (result != null && result.Status == AuthenticationStatus.Success)
    {
      // A token was successfully retrieved. Get the To Do list for the current user  
      await viewModel.BindData();
    }
    else
    {
      // Acquiring a token without user interaction was not possible. 
      // Trigger an authentication experience and specify that once a token has been obtained the GetTodoList method should be called

     authContext.AcquireTokenAndContinue(this.viewModel.RESTApiResourceUri, this.viewModel.AzureADClientId, this.viewModel.AzureADRedirectUri, AuthenticationSuceeded);
         }
    }