6

I'm trying to build a presence channel. But the auth string returned is not correct.

Here is the back end code:

class pusherController extends Controller { protected $pusher; public function __construct(PusherManager $pusher) { $this->pusher = $pusher; } public function pusherPinyinAuth(Request $request) { if($request->user()) { $user = $request->user(); $auth= $this->pusher->presence_auth($request->input('channel_name'),$request->input('socket_id'), $user->id, array('h'=>'user_info')); return response($auth); } } } 

Error message

Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Auth value for subscription to presence-5 is invalid: should be of format 'key:signature'"}}} 

I guess the the error is caused by the additional ':' added before the auth string. But I manually remove that it still report the same error. Here is my string output:

{auth: ":8dacf362f8fe62bae42c33dfe5511d3d1c42144685d5843a6a6a8014490ed0f6",…} 

I'm using the pusher bridge from https://github.com/vinkla/pusher

I'd like to try the official pusher-php-server, but after composer install, I don't know how to use it in my code. I want to know whether https://github.com/pusher/pusher-http-php have the same issue.

2 Answers 2

5

For me this was caused by the pusher key, secret and app_id values not being set correctly in production.

Sign up to request clarification or add additional context in comments.

2 Comments

You have to make sure that your .env file on the server contains all necessary variables and that they are set correctly.
I am setting the valid credentials still facing the same issue.
0

I also face this same error

Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Auth value for subscription to presence-5 is invalid: should be of format 'key:signature'"}}} 

I was able to resolve this by returning an array containing the user details in the channel.php file

see code sample below: channel.php

Broadcast::channel('request_channel', function ($user) { return ['id' => $user->id, 'name' => $user->name]; }); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.