- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
那么如何将 header 身份验证添加到 Ext.Azure.invokeApi()
请求中?我的程序需要 header 认证才能访问自定义api,因为我设置了只有经过认证的用户才有操作权限。
最佳答案
在当前版本中, header 身份验证未添加到调用 API 中 - 但可以通过覆盖轻松添加。
看看 Ext.azure.Azure.getDefaultHeaders() - 您可以将其更改为以下内容:
getDefaultHeaders : function() {
var headers = {
'X-ZUMO-APPLICATION' : this.getAppKey(),
'X-ZUMO-VERSION' : this.getUserAgentString()
};
var authorizedUser = Ext.azure.Authentication.getCurrentUser();
if (typeof authorizedUser !== 'boolean') {
headers['X-ZUMO-AUTH'] = authorizedUser.get('token');
}
return headers;
}
这样就可以了。我将记录一个有关在当前版本中无法执行此操作的错误,并将尝试尽快修复它。
要构建覆盖,请在应用程序中的某个位置包含以下代码:
Ext.define('Ext.override.Azure', {
override : 'Ext.azure.Azure',
getDefaultHeaders : function() {
var headers = {
'X-ZUMO-APPLICATION' : this.getAppKey(),
'X-ZUMO-VERSION' : this.getUserAgentString()
};
var authorizedUser = Ext.azure.Authentication.getCurrentUser();
if (typeof authorizedUser !== 'boolean') {
headers['X-ZUMO-AUTH'] = authorizedUser.get('token');
}
return headers;
}
});
关于javascript - Sencha touch 2 azure如何向invokeApi添加 header 身份验证?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24363273/
我正在使用 Android Azure 移动服务 SDK 连接到 Azure 移动服务。当我使用 MobileServiceClient 的 invokeApi 时,当 Api 在 60 秒内完成时一
有人知道如何使用 Xamarin 组件的 MobileServices SDK 从 Xamarin 客户端调用 Windows Azure 移动服务中的自定义 API 吗? MobileService
我正在将我的 Angular 应用程序与 Azure 服务后端集成。 我最初只是使用标准的 $http 调用,如下所示: $http({ method: 'POST',
设置: 使用 js 库并遵循我的 C# Xamarin 项目的客户端登录/身份验证流程。 CORS 已设置并且初始登录正常: this.client = new WindowsAzure.Mobile
我想从 Azure 移动服务中的自定义 API 获取客户搜索结果。当我使用 Fiddler 检查客户 API 时,它返回多个搜索结果。但我的 Invoke API 只得到一个结果。我怎样才能得到所有结
我正在尝试一些非常简单的事情。我有一个名为“missingvehiclesfrominventoryjob”的自定义 API,它只是从标准 SQL 查询返回记录集。 我可以在 WinForms 和 W
我是一名优秀的程序员,十分优秀!