为什么Laravel Passport不会生成OAuth路线?

发布于 2025-02-13 15:02:38 字数 981 浏览 0 评论 0原文

我有一个清洁的Laravel 9.2的安装。

composer require laravel/passport

然后,我运行迁移并安装护照。

php artisan migrate

php artisan passport:install

所有这些都应该生成必要的身份验证路线?

但是路线列表没有护照路线。

php artisan route:list

获取|头 / .......................................................................................... ................................................................................. ......... 邮政_ignition/execute-solution .. ignition.executesLoute› spatie \ larVallignition› executesLouteController 获取|头_IGNITION/HEALTH-CHECK ............................................................. HEADEATION CHECK› SPATIE \ LARVALVIGNITION› HealthCheckController 发布_IGNITION/update-config ....................... ignition.updateconfig› spatie \ larvellignition› updateConfigController 获取|头部圣所/csrf-cookie ........................................................................................ 。

I have a clean installation of Laravel 9.2.

composer require laravel/passport

Then I run the migrations and install passport.

php artisan migrate

php artisan passport:install

All of that should generate the necessary routes for authentication?

But route list does not have passport routes.

php artisan route:list

GET|HEAD / .........................................................................................................
POST _ignition/execute-solution .. ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController
GET|HEAD _ignition/health-check .............. ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController
POST _ignition/update-config ........... ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController
GET|HEAD sanctum/csrf-cookie ........................................... Laravel\Sanctum › CsrfCookieController@show

Did I missed something to work it properly?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长梦不多时 2025-02-20 15:02:38

PHP Artisan Passport:Install您应该在 boot 方法appport 方法app> app \ providers \ providers \ authserviceProvider中调用Passport ::路由方法。此方法将注册发出访问令牌并撤销访问令牌,客户端和个人访问令牌所需的路线:

public function boot()
{
  $this->registerPolicies();
     
  if (! $this->app->routesAreCached()) {
    Passport::routes();
  }
}

检查软件包 docs

after php artisan passport:install you should call the Passport::routes method within the boot method of your App\Providers\AuthServiceProvider. This method will register the routes necessary to issue access tokens and revoke access tokens, clients, and personal access tokens:

public function boot()
{
  $this->registerPolicies();
     
  if (! $this->app->routesAreCached()) {
    Passport::routes();
  }
}

check the package docs for more details.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文