2016-08-05 81 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。

相关问题