作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
你知道,Laravel Passport 预定义了如下路由:
php artisan route:list
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | POST | oauth/authorize | | ...\ApproveAuthorizationController@approve | web,auth |
| | GET|HEAD | oauth/authorize | | ...\AuthorizationController@authorize | web,auth |
| | DELETE | oauth/authorize | | ...\DenyAuthorizationController@deny | web,auth |
| | GET|HEAD | oauth/clients | | ...\ClientController@forUser | web,auth |
| | POST | oauth/clients | | ...\ClientController@store | web,auth |
| | PUT | oauth/clients/{client_id} | | ...\ClientController@update | web,auth |
| | DELETE | oauth/clients/{client_id} | | ...\ClientController@destroy | web,auth |
| | GET|HEAD | oauth/personal-access-tokens | | ...\PersonalAccessTokenController@forUser | web,auth |
| | POST | oauth/personal-access-tokens | | ...\PersonalAccessTokenController@store | web,auth |
| | DELETE | oauth/personal-access-tokens/{token_id} | | ...\PersonalAccessTokenController@destroy | web,auth |
| | GET|HEAD | oauth/scopes | | ...\ScopeController@all | web,auth |
| | POST | oauth/token | | ...\AccessTokenController@issueToken | throttle |
| | POST | oauth/token/refresh | | ...\TransientTokenController@refresh | web,auth |
| | GET|HEAD | oauth/tokens | | ...\AuthorizedAccessTokenController@forUser | web,auth |
| | DELETE | oauth/tokens/{token_id} | | ...\AuthorizedAccessTokenController@destroy | web,auth |
+--------+----------+-----------------------------------------+------+---------------------------------------------+--------------+
可以修改该路线吗?例如oauth/authorize
变为 api/v1/oauth/authorize
如果是,怎么做?
我一直在寻找答案......
最佳答案
是的,确实如此。您可以在 Passport::routes()
方法中声明自己的路由。
将其包含在 app/Providers/AuthServiceProvider
文件的 boot()
方法中。
app/Providers/AuthServiceProvider.php
public function boot()
{
Passport::routes(null, ['prefix' => 'api/v1/oauth']);
}
关于laravel - 是否可以更改/修改 Laravel Passport 中的预定义路线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52874091/
我是一名优秀的程序员,十分优秀!