laravel passport 安裝設定完後,若使用上出現下面錯誤

You must set the encryption key going forward to improve the security of this library - see this page for more information https://oauth2.thephpleague.com/v5-security-improvements/

解決方法

http://www.imc4.com/archives/5.html

更新 /vendor/laravel/passport/src/PassportServiceProvider.php 中的makeAuthorizationServer方法:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public function makeAuthorizationServer()
{
    $server = new AuthorizationServer(
        $this->app->make(ClientRepository::class),
        $this->app->make(AccessTokenRepository::class),
        $this->app->make(ScopeRepository::class),
        'file://'.Passport::keyPath('oauth-private.key'),
        'file://'.Passport::keyPath('oauth-public.key')
    );
    $server->setEncryptionKey(env('APP_KEY'));
    return $server;
}

待驗證問題