From dbb289b51f483c6c4464cf296a6f9e6c07b28a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Mali=C5=84ski?= Date: Mon, 14 Sep 2020 13:16:49 +0200 Subject: [PATCH] Update passport.blade.md I managed to get passport work with this code, not really sure if loadKeysFrom should be in boot method and if overriding passport config is proper way. --- source/docs/v3/integrations/passport.blade.md | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/source/docs/v3/integrations/passport.blade.md b/source/docs/v3/integrations/passport.blade.md index 3fb0503..ac584d7 100644 --- a/source/docs/v3/integrations/passport.blade.md +++ b/source/docs/v3/integrations/passport.blade.md @@ -22,14 +22,50 @@ To use Passport inside the tenant part of your application, you may do the follo PreventAccessFromCentralDomains::class, ]]); ``` + +- Add this to `boot` method in your `AppServiceProvider`: + + ```php + Passport::loadKeysFrom(base_path(config('passport.key_path'))); + ``` - `php artisan vendor:publish --tag=passport-migrations` & move to `database/migrations/tenant/` directory +- Create `passport.php` file in your config directory and add database connection and key path config. This makes passport use the default connection. + + ```php + [ + 'database' => [ + 'connection' => null, + ], + ], + 'key_path' => env('OAUTH_KEY_PATH', 'storage') + + ]; + ``` + +You may set the OAUTH_KEY_PATH in your .env, but by default `passport:keys` puts them in `storage/` directory + ## **Shared keys** If you want to use the same keypair for all tenants, do the following. -- Don't use `passport:install`, use just `passport:keys`. The install command creates keys & two clients. Instead of creating clients centrally, create `Client`s manually in your [tenant database seeder]({{ $page->link('configuration#seeder-params') }}). +- Don't use `passport:install`, use just `passport:keys`. The install command creates keys & two clients. Instead of creating clients centrally, create `Client`s manually in your [tenant database seeder]({{ $page->link('configuration#seeder-params') }}), like this: + + ```php + public function run() + { + $client = new ClientRepository(); + + $client->createPasswordGrantClient(null, 'Default password grant client', 'http://{{your.redirect.path}}'); + $client->createPersonalAccessClient(null, 'Default personal access client', 'http://{{your.redirect.path}}'); + } + ``` + ## **Tenant-specific keys** {#tenant-specific-keys}