1

Azure Active Directory OAuth エンドポイントに対して認証する必要がある Windows Phone 8.1 アプリ (Windows ランタイム) を作成しています。OAuth トークンを取得するための認証マネージャーとして、WP81 nuget パッケージの ADAL を使用しています。

私が苦労している問題は、電話ページのライフサイクルでさまざまな ADAL ログイン メソッドを呼び出す必要がある場所です。今、私はイベントに電話AuthenticationContext.AquireTokenAndContine()していPage.Loadedます。github サンプル コードで説明されているようにContinuationManager、 、IWebAuthenticationContinuable、およびイベントも実装しました。クライアントURIを取得するためにApp.Activatedも使用しています。Windows.Security.Authentication.Web.WebAuthenticationBroker.GetCurrentApplicationCallbackUri()

何をしても、次のエラーが引き続き発生します。私に何ができるかについての洞察はありますか?よろしくお願いいたします。

mscorlib.ni.dll で 'Microsoft.IdentityModel.Clients.ActiveDirectory.AdalException' が発生しましたが、ユーザー コードで処理されませんでした

追加情報: authentication_ui_failed: ブラウザー ベースの認証ダイアログが完了しませんでした

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);
         }
    }
4

1 に答える 1

1

ADAL は、WebAUthenticationBroker (WAB) を使用してプロンプトを表示します。Windows Phone 8.1 の WAB は、アプリの UX 全体が読み込まれるまで表示されないため、少なくとも WAB の動作が変わらない限り、現在のメソッドの場所は機能しません。同様のスレッドについては、「Windows Phone の Azure Active Directory で認証に失敗した」を参照してください。

于 2015-02-23T08:46:35.417 に答える