Quickblox REST API上Laravel意外签名 [英] Quickblox REST API Unexpected signature on Laravel

查看:336
本文介绍了Quickblox REST API上Laravel意外签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到来自QuickBlox REST API以下JSON响应:

I'm getting the following json response from QuickBlox REST API:

{
    "base": ["Unexpected signature"]
}

我的签名方法:

My signature method:

private function createSignature($login, $password, $timestamp, $nonce)
{
    $signatureContent = "application_id=" . env('QB_APP_ID') .
        "&auth_key=" . env('QB_APP_KEY') .
        "&nonce=" . $nonce .
        "&timestamp=" . $timestamp .
        "&user[login]=" . $login .
        "&user[password]=" . $password;

    return hash_hmac('sha1', $signatureContent, env('QB_APP_SECRET'));
}

应用程序ID和身份验证密钥,并是正确的。该 $ signatureContent 值(断裂线只是为了提高可读性文本):

The Application ID and Auth Key and is correct. The $signatureContent value(break lines just to improve the text readability):

application_id=24544
&auth_key=6N9bYKT-fKGRQ7q
&nonce=268302610
&timestamp=1438287989
&user[login]=tester1@test.net
&user[password]=qwer1234

我得到这个答复,当我尝试创建一个会话,使用此PARAMS:

I getting this response when I try to create a session, using this params:

$postBody = http_build_query([
    'application_id' => env('QB_APP_ID'),
    'auth_key' => env('QB_APP_KEY'),
    'timestamp' => $ts, // SAME VALUE ON SIGNATURE: 1438287989
    'nonce' => $nonce, // SAME VALUE ON SIGNATURE: 268302610
    'signature' => $signature,
    'user[login]' => $login,
    'user[password]' => $password
]);

// cURL Request and Response....

有什么毛病我的签名?

What's wrong with my signature?

推荐答案

我创建一个新的用户注册,所以是没有必要的用户[登录]和用户[密码] PARAMS。在签署这些PARAMS需要而已。

I'm creating a new user register, so aren't necessary user[login] and user[password] params. These params are required just to sign in.

这篇关于Quickblox REST API上Laravel意外签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆