mirror of
https://github.com/stancl/tenancy-docs.git
synced 2025-12-12 02:04:03 +00:00
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.
This commit is contained in:
parent
ee024c7e5b
commit
dbb289b51f
1 changed files with 37 additions and 1 deletions
|
|
@ -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
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'storage' => [
|
||||
'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}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue