Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth and private channel #6

Open
1e4 opened this issue Aug 28, 2014 · 3 comments
Open

Auth and private channel #6

1e4 opened this issue Aug 28, 2014 · 3 comments

Comments

@1e4
Copy link

1e4 commented Aug 28, 2014

Is there anyway to auth a user with laravels Auth::check() and only send data to private channels?

@1e4 1e4 changed the title Auth and private channe Auth and private channel Aug 28, 2014
@gurpreet2013
Copy link

I am also trying to do the same. Any ideas??

@1e4
Copy link
Author

1e4 commented Jan 24, 2015

Nope no answer yet.

@gpedro
Copy link
Contributor

gpedro commented Oct 28, 2015

i don't know if you solved that problem, but the soluction is:

1 - Create PusherController


    public function auth()
    {
        // make your logic to allow autentication
        if (Input::has('channel_name') && Input::has('socket_id')) {
            $socket = Pusherer::socket_auth(Input::get('channel_name'), Input::get('socket_id'));
            return Response::make($socket);
        }

        return Response::make('Forbidden', 403);
    }

2 - routes.php, you need create /pusher/auth

Route::post('/pusher/auth',  array('as' => 'api.pusher', 'uses' => 'PusherController@auth'));

Done. Now whenever you subscribe to a channel with private prefix, you will consult this route to authenticate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants