Quickblox REST API Unexpected signature on Laravel

不问归期 提交于 2019-12-31 07:32:29

问题


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'));
}

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

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?


回答1:


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.



来源:https://stackoverflow.com/questions/31733629/quickblox-rest-api-unexpected-signature-on-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!