2016-08-05 83 views
0

調用登錄方法,輸入則有效憑據獲得:Azure的移動應用-JS-客戶端登錄

您沒有權限查看該目錄或頁面

中的網址彈出窗口是:「https://zzz.azurewebsites.net/.auth/login/aad/callback

我期待登錄方法只需完成並返回用戶(或身份驗證令牌等),就像它在我的移動(Xamarin)應用程序中使用MobileServiceClient時一樣。

 this.client = new WindowsAzure.MobileServiceClient('https://zzz.azurewebsites.net'); 
    this.client.login("aad").done(function (results) { 
    console.log(results); 
    alert("You are now logged in as: " + results.userId); 
    }, function (err) { 
     alert("Error: " + err); 
    }); 

我在本地機器上調試這個web應用程序。

+0

CORS如何在您的應用服務上設置? –

+0

我的應用服務中沒有任何CORS條目。 – Triple888Three

回答

1

Azure門戶>應用程序服務>您的移動應用程序>工具>資源管理器> Go。

在左側導航欄中展開您的站點的config,authsettings節點。點擊編輯

尋找「allowedExternalRedirectUrls」元素。它將被設置爲空。 它更改爲以下:

"allowedExternalRedirectUrls": [ 
    "http://localhost:3000", 
    "https://localhost:3000" 
], 

與服務的網址替換的URL。

https://github.com/Azure/azure-content/blob/master/articles/app-service-mobile/app-service-mobile-cordova-how-to-use-client-library.md#how-to-configure-your-mobile-app-service-for-external-redirect-urls

0

這是最好在Azure上託管時爲Azure中包含完整的認證實施應用測試認證。本地開發存在一個存根,但它有一些注意事項,例如某些平臺不適用,並且需要某些平臺使用HTTPS。

相關問題