Laravel 7.x中的自定义登录和注销响应>>

问题描述 投票:0回答:1

我正在尝试从create-react-app应用程序登录和注销,该应用程序使用Laravel 7.x作为后端的应用程序。我在哪里可以将Laravel 7.x中/login/logout身份验证路由的自定义响应消息放入。我使用了artisan命令进行身份验证脚手架。

我了解Laravel中的单页应用程序身份验证。它在Laravel Sanctum页面中给出。 https://laravel.com/docs/7.x/sanctum。我已经跟踪了那里的所有内容,对此没有任何问题。

即使我在/home中的行注释

中也重定向到LoginController.php路由>
    protected $redirectTo = RouteServiceProvider::HOME;

我试图查看文档https://laravel.com/docs/7.x/authentication,其中说“ Laravel提供了一个空的authenticated(Request $ request,$ user)方法,如果需要的话,该方法可能会被覆盖:”。但是不知道该方法可以写在哪里。

我正在尝试从create-react-app应用程序登录和注销,该应用程序使用Laravel 7.x作为后端的应用程序。我在哪里可以将/ login和/ logout auth的自定义响应消息放入...

api authentication create-react-app laravel-7 custom-authentication
1个回答
0
投票

所以我将回答我自己的问题。 AuthenticatesUsers.php目录中存在的特征vendor/laravel/ui/auth-backend/中存在此方法。

我在上述链接中存在的authenticated()特性中的AuthenticateUsers.php空方法中添加了此选项。

© www.soinside.com 2019 - 2024. All rights reserved.