- Laravel6
- lighthouse-php5
I'm using lighthouse-php for GraphQL Subscription and pusher.
lighthouse-php5 gives graphql/subscriptions/auth
. But I can't find how to set guard this api.
My app has multiple authentications(user and admin), so I want to switch guard. Then I create the api route,
Route::middleware(['guard_xxx'])->group(function(){
Route::post('xxx/graphql/subscriptions/auth', '\Nuwave\Lighthouse\Subscriptions\SubscriptionController@authorize');
});
config/lighthouse.php
'guard' => 'guard_yyy',
I run xxx/graphql/subscriptions/auth
, but guard_yyy run. I want to use guard_xxx.
You have manually defined the subscriptions authentication route. I think what is happening is that Lighthouse overrides that one. You will need to disable the one Lighthouse is registering, you can do that by going into your
config/lighthouse.php
config file and finding the broadcaster you are using, it should look something like this:Remove the
routes
key from the broadcaster configuration to stop Lighthouse from registering the broadcasting authentication route itself so you can define it and set a different guard for it.Also note that this wil also result in not registering the Pusher webhook route which you might need, so you will need to define that one yourself too.