设置后卫订阅验证
- Laravel6
- Lighthouse-PHP5
我正在使用Lighthouse-PHP进行GraphQL订阅和推动器。 Lighthouse-PHP5给出GraphQL/usivections/auth
。但是我找不到如何设置此API。
我的应用程序具有多个身份验证(用户和管理员),因此我想切换Guard。 然后,我创建API路由,
Route::middleware(['guard_xxx'])->group(function(){
Route::post('xxx/graphql/subscriptions/auth', '\Nuwave\Lighthouse\Subscriptions\SubscriptionController@authorize');
});
config/lighthouse.php
'guard' => 'guard_yyy',
i运行xxx/graphql/subpcriptions/auth
,但guard_yyy运行。我想使用guard_xxx。
- 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经手动定义了订阅身份验证路线。我认为正在发生的事情是灯塔覆盖了那个。您将需要禁用一个灯塔正在注册,您可以通过进入
config/lighthouse.php
配置文件并查找所使用的广播公司来做到这一点,它应该看起来像这样:删除
路由
从广播员配置中键,以阻止灯塔注册广播身份验证路由本身,以便您可以定义它并为其设置不同的后卫。另请注意,此WIR还会导致不注册您可能需要的Pusher Webhook路由,因此您也需要自己定义一个。
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.