I'm trying to implement a chat server using Laravel Echo, Redis, Websocket, Vue JS and tymon/jwt-auth. I need my broadcast auth route to be authenticated by jwt.
When I make a post request with 'Bearer my_token' to '/broadcasting/auth' it throws AccessDeniedHttpException. I've set up my BroadcastServiceProvider like so:
The issue is thrown on Tymon\JWTAuth\Middleware\Authenticate @handle The error message is not helpful at all. Fairly straight forward to reproduce as I could do it on a fresh laravel installation as well.
Could it be, after successful authentication the package is not returning an expected type of response that is expected by the Broadcaster::authenticate method?
That's the Broadcaster::authenticate method that's handling the final response. Maybe $request->user() is not accessible by it?
I don't even know if this is a Laravel shortcoming, package issue.
Please suggest...
Your environment
Q
A
Bug?
yes
New Feature?
no
Framework
Laravel
Framework version
5.6.x
Package version
1.0.0-rc.2
PHP version
7.2
Steps to reproduce
On a fresh Laravel installation, configure Tymon/JWTAuth and then enable Broadcast service provider.
Configure Broadcast service providers Broadcast::routes() with attributes to use jwt.auth middleware like this:
Broadcast::routes(['middleware' => [ 'api' ,'jwt.auth' ]]);
Make a POST request with a valid bearer token to /broadcasting/auth endpoint
I found a solution, update your jwt-auth package into 1.0.0-rc.2, apply the docs then modify the BroadcastServiceProvider into Broadcast::routes(['middleware' => ['auth:api']]);
I found a solution, update your jwt-auth package into 1.0.0-rc.2, apply the docs then modify the BroadcastServiceProvider into Broadcast::routes(['middleware' => ['auth:api']]);
this return 404 in console developer.. any suggest?
Subject of the issue
I'm trying to implement a chat server using Laravel Echo, Redis, Websocket, Vue JS and tymon/jwt-auth. I need my broadcast auth route to be authenticated by jwt.
When I make a post request with 'Bearer my_token' to '/broadcasting/auth' it throws
AccessDeniedHttpException
. I've set up myBroadcastServiceProvider
like so:Broadcast::routes(['middleware' => [ 'api' ,'jwt.auth' ]]);
The issue is thrown on
Tymon\JWTAuth\Middleware\Authenticate @handle
The error message is not helpful at all. Fairly straight forward to reproduce as I could do it on a fresh laravel installation as well.Could it be, after successful authentication the package is not returning an expected type of response that is expected by the Broadcaster::authenticate method?
Since the error is invoked like this:
That's the Broadcaster::authenticate method that's handling the final response. Maybe $request->user() is not accessible by it?
I don't even know if this is a Laravel shortcoming, package issue. Please suggest...
Your environment
Steps to reproduce
jwt.auth
middleware like this:Broadcast::routes(['middleware' => [ 'api' ,'jwt.auth' ]]);
Expected behaviour
User authenticates successfully.
Actual behaviour
Laravel throws
AccessDeniedHttpException