2016-07-20 15 views
1

私はAzure App Serviceを使用しています。ユーザーを認証するためにMicrosoftアカウントを使用したいと思いますが、ユーザーが自分の認証情報を入力して「あなたは正常にウェブサイトにログインしました」を取得した後、私のUWPに制御を戻しません。私はLoginAsyncから「真」を削除した場合、私は例外だAzureモバイルアプリ認証

LiveLoginResult result = await liveIdClient.LoginAsync(new[] "wl.basic" }); 

if (result.Status == LiveConnectSessionStatus.Connected) 
{ 
session = result.Session; 
var client = new LiveConnectClient(result.Session); 
LiveOperationResult meResult = await client.GetAsync("me"); 

var provider = MobileServiceAuthenticationProvider.MicrosoftAccount; 
user = await App.MobileService.LoginAsync(provider, true); 

} 

は言う:認証応答の 無効な形式

は、ここに私のコードです。

答えて

0

サインインのためにLive SDKでMicrosoftアカウントを使用したい場合は、user = await App.MobileService.LoginAsync(provider, true);がここにないと思います。このシナリオでは

、我々はサインインしてくださいモバイルアプリのバックエンドに返されたトークンを使用する必要があります。

MobileServiceUser loginResult = await App.MobileService 
       .LoginWithMicrosoftAccountAsync(result.Session.AuthenticationToken); 

user = await App.MobileService.LoginAsync(provider);方法は、認証のためですが、彼らは異なっている、Active Directoryの認証ライブラリを小枝。

Client-managed authenticationを参照してください。

+0

MobileServiceInvalidOperationException型の例外がスローされます –

+0

@ MustafaSaeed、 'var provider = MobileServiceAuthenticationProvider.MicrosoftAccount;を置き換えようとしましたか? user = await App.MobileService.LoginAsync(provider、true); 'MobileServiceUser loginResult = App.MobileServiceを待機します .LoginWithMicrosoftAccountAsync(result.Session.AuthenticationToken);'? –

+0

はい、私はそれを行い、その行は例外をスローする –

関連する問題