- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用这个 link获得描述的响应:
{
"session": {
"application_id": 2,
"created_at": "2012-04-03T07:34:48Z",
"device_id": null,
"id": 743,
"nonce": 1308205278,
"token": "0e7bc95d85c0eb2bf052be3d29d3df523081e87f",
"ts": 1333438438,
"updated_at": "2012-04-03T07:34:48Z",
"user_id": null
}
}
但现在它说找不到应用程序:
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>No application found</error>
</errors>
无法继续测试其他请求。这是我用来获取 curl 请求的 shell 脚本:
timestamp=`date +%s`
body="application_id=HIDDENAPPLICATIONIDHERE&auth_key=HIDDENAUTHKEYHERE&nonce=2342546×tamp=$timestamp"
signature=`echo -n $body | openssl sha -hmac HIDDENSECRETHERE`
body=$body"&signature="$signature
#echo $body
#echo $signature
#exit 0
curl -X POST \
-H "QuickBlox-REST-API-Version: 0.1.0" \
-d $body \
https://api.quickblox.com/session.xml
所以有一些信息表明这可能是我以错误的方式创建了 shell 脚本:
HMAC-SHA function of the body of the request, with a key auth_secret. Request body is formed as the sorted (sorting alphabetically, as symbols, not as bytes) by increase the string array 'parameter=value', separated with the symbol "&". For the parameters passed as a user[id]=123 is used just such a line of user[id]=123
我还准备了一个 Swift project如何生成签名和获取session,还是报同样的错误,没有找到应用。
有什么推荐吗?谢谢
最佳答案
请验证应用程序 ID 参数,因为服务器返回:
<?xml version="1.0" encoding="UTF-8"?>
<errors>
<error>No application found</error>
</errors>
例如生成签名(Java):
Random random = new Random();
String nonce = Integer.toString(random.nextInt());
long time = System.currentTimeMillis() / 1000;
String timestamp = Long.toString(time);
String signature;
String str = "application_id=" + applicationId + "&" + "auth_key=" + authKey + "&" + "nonce="
+ nonce + "&" + "timestamp=" + timestamp + "&" + "user[login]=" + adminLogin + "&" + "user[password]="
+ adminPassword;
signature = UtilsMethods.calculateHMAC_SHA(str, authSecret);
计算HMAC_SHA:
private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1";
public static String calculateHMAC_SHA(String data, String key) throws SignatureException {
String result = null;
try {
// get an hmac_sha1 key from the raw key bytes
SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), HMAC_SHA1_ALGORITHM);
// get an hmac_sha1 Mac instance and initialize with the signing key
Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
mac.init(signingKey);
byte[] digest = mac.doFinal(data.getBytes());
StringBuilder sb = new StringBuilder(digest.length * 2);
String s;
for (byte b : digest) {
s = Integer.toHexString(0xFF & b);
if (s.length() == 1) {
sb.append('0');
}
sb.append(s);
}
result = sb.toString();
} catch (Exception e) {
throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
}
return result;
}
关于ios - Quick blox - 签名生成问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37887048/
当我打开一个 Xcode 项目时,快速帮助功能工作得很好,但是当打开一个不在打开的项目中的文件(例如 abc.swift )时,文档不会出现。 下面是一个例子: 最佳答案 安装版本Command Li
我扩展了org.eclipse.ui.editors.text.TextEditor来实现自定义编辑器。对于此编辑器,我定义了一个标记类型(org.eclipse.core.resources.mar
我将 Xcode 7 beta 5(这是当前安装的唯一 xcode)与 Swift 2 一起使用,当我尝试使用 Quick 运行单元测试时,出现以下错误: error: module file was
我有一个 Excel 文档,从另一个 xls 中提取项目作为列表项来填充下拉菜单。问题是,有很多选择。我找不到快速到达我想要的区域的方法。 (例如,打开下拉列表并按“b”不会像大多数普通下拉列表那样转
如果出现给定情况,我有一组测试会使整个测试套件崩溃。而且,那种情况对于套件来说已经是失败了。 与其崩溃,我宁愿在系列设置期间测试条件是否为真,并在失败时快速中止它。 这可能吗? 最佳答案 是的,您可以
Currentyl 我正在开发一个 Java Web 应用程序,一些简单的 JSF + Spring + Hibernate 教科书应用程序架构,但我发现每次我必须这样做时,我都会在将 WAR 上传到
当我使用 --quick option 运行 mysql 时正如另一个网络帖子中所建议的描述 返回很多 -- 而当我在没有 --quick 的情况下运行 mysql 时选项 desc table返回正
是解决Quick sort中最差时间复杂度的中位数3吗? 还有, 使用 3 的中位数方法时是否存在最坏情况的时间复杂度? 最佳答案 我认为一直以中位数为基准的快速排序的最差时间复杂度是 O(nlogn
我想创建一个自定义对话框,例如联系人应用程序中的“快速联系”或官方 Twitter 应用程序中的对话框。当我点击一个按钮时,它会在按钮上方或下方打开。 http://londatiga.net/ima
开始为 Linux 平台编写 C 代码,我正在使用 man 工具来获取有关标准库函数的信息。现在我想知道有什么解决方案可以轻松获取有关这些函数使用的结构的信息。 此处的示例是 man sched_se
1.视图模型介绍 在qml中、常见的view视图有: listview: 列表视图,视图中数据来自listmodel、xmllistmodel或c++中继承自qabstractitemmo
目录 1.Popup介绍 2.自定义Popup 1.Popup介绍 Popup是一个弹出窗口的控件 它的常用属性如下所示: ancho
PathView ,顾名思义,沿着特定的路径显示 Model 内的数据。 Model 能够是 QML 内建的 ListModel 、 XmlListModel ,也能够是在 C++ 中实现的 QAb
[对于那些不在家的人,这是 Rolling My Own Version Control 的续集;)] 所以我放弃并安装了 TortoiseSVN(为了和 friend 一起做一个项目,我的个人版本控
我试图在Qt Quick应用程序中打开一个链接,收到functions are not supported in Qt Quick ui form警告,该应用程序正常工作,我想摆脱该警告,如何解决此警
我对 Qt 和 Qt Quick 非常陌生。我正在验证 Qt Quick 的 Qt Test 单元测试框架,但我无法理解如何运行测试。这就是我所拥有的,我创建了一个具有以下结构的 SUBDIRS 项目
我有执行简单选择的存储过程。任何时候我手动运行它,它都会在秒下运行。但是在生产中(SQL Azure S2 数据库),它每 12 个我们的计划任务内运行一次 - 所以我认为期望它每次都以“冷”运行是合
我正在使用quick-Json在我的程序中序列化 HashMap(String, String[]) ,但我在反序列化该对象时遇到问题。我使用此代码来序列化 map JsonGenerator
是的,我知道这个问题在技术上将是“开放式的”,并且可能会“引起辩论”,但请记住,我并不是在这里询问方向,我只是想确保我在右场。所以,话虽这么说,这是我的问题: 我想创建一个程序,允许用户输入并存储 1
我想拦截Qt Quick事件,比如key events ,这样我就可以在它们到达当前目标之前处理它们,例如当前的 focused item ,可选择阻止事件在默认事件链中传播。可以通过QML代码处理事
我是一名优秀的程序员,十分优秀!