使用AAD&QUOT的Azure移动服务;在'承载'HTTP认证方案,不支持"错误 [英] Azure mobile service using aad "The 'Bearer' HTTP authentication scheme is not supported" error
问题描述
我有一个蓝色的移动服务设置和在网上跟着例子进行身份验证。我叫AuthenticationContext.AcquireToken并取回一个令牌。然后,我用设置页眉:
I have an Azure mobile service setup and have followed the examples online for authenticating. I call AuthenticationContext.AcquireToken and get back a token. Then I set the header using:
HttpClient.DefaultRequestHeaders.Authorization =新AuthenticationHeaderValue(载体,AquireAccessToken());
HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AquireAccessToken());
但是我得到一个401回,并在天青日志我收到不支持'承载'HTTP认证方案。我缺少什么?
However I am getting a 401 back and in the Azure logs I am getting "The 'Bearer' HTTP authentication scheme is not supported". What am I missing?
推荐答案
如果您正在使用的服务来调用移动服务为什么不使用应用程序键,而不是一个登录过程?
If you are using a service to call the mobile service why not use the Application key instead of a login process?
您可以按您的要求,像这样设置标题:
You can set a header on your request like so:
HttpClient.DefaultRequestHeaders.Add("X-ZUMO-APPLICATION", "<YOUR APP KEY>";
您可以从您的门户应用的关键。当你在仪表板视图中单击该按钮在窗口底部的管理密钥。
You can get your application key from the portal. When you are on the dashboard view click the button at the bottom of the window to "manage keys".
这工作,如果你想登录的服务,但如果您需要登录代表用户,那么你就需要去验证路线。您还需要确保你的各种表格和API的权限允许访问的应用的关键水平。
This works if you want to login as the service, but if you need to login on behalf of a user, then you'll need to go the authentication route. You'll also need to make sure the permissions on your various tables and APIs allow the application key level of access.
另外,你可以使用的 X-谟-MASTER 的与你的主密钥头获得管理权限的服务。
Alternately, you can use the X-ZUMO-MASTER header with your master key to get admin rights to the service.
这篇关于使用AAD&QUOT的Azure移动服务;在'承载'HTTP认证方案,不支持&QUOT;错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!