2016-02-05 29 views
1

我正在開發Windows 10 UWP應用程序,因爲我正在使用Azure移動服務使用Azure移動服務作爲提供者來實現身份驗證用戶。在.Net後端使用Microsoft帳戶驗證用戶Azure移動服務在登錄後提供錯誤

我也跟着下面的文章與該應用程序登記的移動服務

https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/

以下是我在我的應用Live設置 enter image description here

更新的細節我的手機服務是一個.NET後端服務https://astraniprod.azure-mobile.net/

並且還更新了移動服務中的客戶端ID,祕密應用SID。

後,我寫了下面的代碼,啓動登錄彈出我的應用程序

private async System.Threading.Tasks.Task<bool> AuthenticateAsync() 
    { 
     string message; 
     bool success = false; 
     try 
     { 
      // Change 'MobileService' to the name of your MobileServiceClient instance. 
      // Sign-in using Facebook authentication. 
      user = await App.MobileService 
       .LoginAsync(MobileServiceAuthenticationProvider.MicrosoftAccount,true); 
      message = 
       string.Format("You are now signed in - {0}", user.UserId); 

      success = true; 
     } 
     catch (InvalidOperationException) 
     { 
      message = "You must log in. Login Required"; 
     } 

     var dialog = new MessageDialog(message); 
     dialog.Commands.Add(new UICommand("OK")); 
     await dialog.ShowAsync(); 
     return success; 
    } 
} 

我能看到登錄對話,也進入了我的Microsoft帳戶和密碼,在那之後我收到以下錯誤

enter image description here

我見過的其他人也發佈了關於這個在論壇,但我沒有找到問題的解決方案,我不知道在哪裏的問題是,其他供應商,如谷歌,Twitter的, Facebook工作很好,但只有Microsoft帳戶不能正常工作。

謝謝。

回答

2

我認爲問題在於重定向URI。

如果你打開瀏覽器 http://astraniprod.azure-mobile.net/login/microsoftaccount

你會看到一個登錄頁面,登錄後,你會得到「無法完成您的請求」頁面。

在URL中是一個參數,表示問題: error_description = + + + + + + +參數+'redirect_uri'+的+ provided +值+ +不+有效+ +期望+值+是+ 'https://login.live.com/oauth20_desktop.srf'+或+ a + URL +其中+匹配+ +重定向+ URI +註冊+用於+此+客戶端+應用程序。

您可以確保您的應用程序配置爲重定向到手錶https://astraniprod.azure-mobile.net/signin-microsoft

此外,還要確保你有關與商店中的應用按照步驟2,3,4: https://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/

如果你已經完成了上述,它應該工作。如果沒有,我們會進一步幫助。

+0

感謝您的回覆和有價值的解釋,它正在工作,現在我錯誤地在導致此問題的URL末尾添加空格。 – narendramacha

相關問題