Multi-Tenancy with Private Channels
Hi,
In a multi-tenancy environment I have laravel-websockets running on a primary server. To let another app on a different server use this service I've created a second app in config/websockets.php.
I can connect to it from my 'other app'. However when trying to access a private channel I need to authenticate. To accomplish that I do the following on the primary server:
- Create seperate routes for authentication. In BroadcastServiceProvider.php added:
Broadcast::routes(['prefix' => 'device', 'middleware' => ['client', 'auth.guest']]); - The client middleware is to allow machine to machine login
- The auth.guest middleware is logging in a dummy user because Laravel requires a $user for Private/Presence channels
On the 'client app' I define the correct information to Echo (authEndPoint & auth information) so it can connect to the correct url for authentication. Also in config/broadasting.php I have the correct information for the app I want to connect with. It's also connecting with the correct app so that's OK.
Authenticating is succesfull from the app but it returns an auth key with the wrong APP ID.
How can I instruct the primary server to return auth key for another app when authenticating via the authEndPoint for this application?
Because now I get an error 'InvalidSignature' in my attempt to subscribe to the private channel. Seems logical since this is probably a signature for the 'main' websockets application.
Hope I'm in the right place here and my question is clear.
Best regards
I have same issue, beside if i tried to skip it Im facing that my default app configuration never change while pushing. @mpociot
@jandante have you found a solution?
@jandante have you found a solution?
Not really.
I'm using one websockets app for all my websockets needs :). Would love to be able to split them but when in need for authentication I always run into this.
I might be doing something wrong but since you are experiencing the same I suppose my findings are correct.