Closed hubertnnn closed 1 year ago
Can you share the version of the library in use so I can look to replicate this?
I am using version 7.2.0
.
But it seems that the same error is on master as well (not tested though).
Can you verify the Pusher object is instantiated correctly? I am only able to replicate this when I do not specify the key correctly upon calling $pusher = new Pusher\Pusher('key','secret','id',$options)
.
Yes, it is. Here is the minimum code that triggers the error:
$appId = '1234567';
$key = '1234567890abcdefghij';
$secret = '123456789abcdefghijk';
$cluster = 'eu';
$socketId = '123456.12345678';
$pusher = new Pusher($key, $secret, $appId, ['cluster' => $cluster]);
$token = $pusher->authenticateUser($socketId, [
'id' => 'e:1',
'user_info' => [
'name' => 'Jimmy',
'email' => 'jimmy@example.com',
],
]);
dump($token);
die();
This outputs:
{
"auth":"dc6f1387915bfe0ab499c54a48ef71de26afced245ac399fe6418bcae50057c8",
"user_data":"{\"id\":\"e:1\",\"user_info\":{\"name\":\"Jimmy\",\"email\":\"jimmy@example.com\"}}"
}
But it should output:
{
"auth":"1234567:dc6f1387915bfe0ab499c54a48ef71de26afced245ac399fe6418bcae50057c8",
"user_data":"{\"id\":\"e:1\",\"user_info\":{\"name\":\"Jimmy\",\"email\":\"jimmy@example.com\"}}"
}
Aka, its missing the appId
from the auth
(based on documentation).
Its fake data, but gives the same issue as real one.
Thanks, I have replicated this and will raise with our engineering team to resolve.
Thanks for catching this oversight. This has been fixed in 7.2.1.
When using signature generated by php library pusher responds with error:
Invalid format: auth must have the format key:signature
It seems that there is a bug in how the signature is generated and its missing thekey:
part.Most likely
Pusher::authenticateUser()
function should have something like:instead of