Framework: BroadcastException in PusherBroadcaster.php line 105: Unknown auth_key

Created on 4 May 2017  路  2Comments  路  Source: laravel/framework

  • Laravel Version: 5.3.*
  • PHP Version: 5.6.17
  • Database Driver & Version:
    mysql

    Description:

When broadcasting event via pusher I get the error >BroadcastException in PusherBroadcaster.php line 105: Unknown auth_key

Steps To Reproduce:

I have created a simple event:

<?php

namespace App\Events;

use App\Models\Presentation;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class PresentationCreated implements ShouldBroadcast
{
    use InteractsWithSockets, SerializesModels;

    public $presentation;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Presentation $presentation)
    {
        $this->presentation = $presentation;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('presentation');
    }

that i trigger by calling event(new PresentationCreated($presentation));

I have installed "pusher/pusher-php-server": "^2.5.0" and created an account in pusher.
I put my pusher credentials in .env:

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=335290
PUSHER_APP_KEY=44a8eeb4fd7006c0b644
PUSHER_APP_SECRET=1ba96d31d7fcfc2e499e
PUSHER_APP_CLUSTER=eu

in my config\broadcast.php I have:

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                //
            ],
        ],

I have all my frontend set up to receive the broadcasts but I think the problem is way before that. It seems that the app_key is not valid or something but I can't figure out why. I already generated a new set of credentials in pusher dashboard but the problem persists. Any clues on why?

Most helpful comment

I solved the problem by adding this to my config\broadcasting.php

    'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
              'cluster' => 'eu',
              'encrypted' => true,
            ],

@marcusmoore yes, thanks for the advice. I forgot to remove the credentials but I already changed them. Thanks.

All 2 comments

I'm not sure if the ones included are old or re-generated but if those are valid credentials then you probably want to reset them so your account doesn't get used nefariously.

I solved the problem by adding this to my config\broadcasting.php

    'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
              'cluster' => 'eu',
              'encrypted' => true,
            ],

@marcusmoore yes, thanks for the advice. I forgot to remove the credentials but I already changed them. Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

felixsanz picture felixsanz  路  3Comments

jackmu95 picture jackmu95  路  3Comments

JamborJan picture JamborJan  路  3Comments

shopblocks picture shopblocks  路  3Comments

RomainSauvaire picture RomainSauvaire  路  3Comments