默认情况下,Passport 发放的访问令牌是永久有效的,不需要刷新。但是如果你想自定义访问令牌的有效期,可以使用 tokensExpireIn 和refreshTokensExpireIn 方法。上述两个方法同样需要在 AuthServiceProvider 的boot 方法中调用:use Carbon\Carbon;/** * Register any authenti
API Authentication (Passport) - Laravel中文网 , laravel中文文档。Laravel 是一个具有表现力、优雅语法的 Web 应用程序框架. Laravel 是构建现代全栈 Web 应用程序的最佳选择.
* Register any authentication / authorization services. * * @return void*/publicfunctionboot() {$this->registerPolicies(); Passport::routes(); Passport::tokensExpireIn(now()->addDays(30)); //这里设置为30天过期 Passport::refreshTokensExpireIn(now()->addDays(30)); } } 3. config/auth.php...
If needed, you can customize the laravel_token cookie's name using the Passport::cookie method. Typically, this method should be called from the boot method of your AuthServiceProvider:1/** 2 * Register any authentication / authorization services....
Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. Passport is built on top of the League OAuth2 server that is maintained by Andy Millington and Simon Hamp....
Laravel makes API authentication a breeze using Laravel Passport, which provides a full OAuth2 server implementation for your Laravel application in a matter of minutes. Passport is built on top of the League OAuth2 server that is maintained by Andy Millington and Simon Hamp....
我们将会学习使用 Laravel 的 Passport API OAuth 来创建一个验证系统。 第一步. 安装 Laravel 我们需要用以下命令来创建一个最新的 Laravel 应用,所以请打开终端执行: laravel new auth 第二步. 安装 Laravel Passport 包 Laravel Passport 可以在几分钟内为你的应用实现一个完整的 OAuth2 服务器。 composer requi...
* Register any authentication / authorization services. * * @return void*/publicfunctionboot() {$this->registerPolicies(); Passport::routes();//注册passport路由 //令牌的有效期Passport::tokensExpireIn(Carbon::now()->addDays(15)); Passport::refreshTokensExpireIn(Carbon::now()->addDays(30));...
/** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); Passport::routes(); Passport::personalAccessClientId('client-id'); }管理个人访问令牌创建个人访问客户端后,你可以使用 User 模型实例上的 createToken 方法来为给定...
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation. Code of Conduct In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct. Security Vulnerabilities If you dis...