Skip to content

Commit

Permalink
update readme file, fix some little things
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Tsapiro committed Nov 22, 2019
1 parent c8ecdd3 commit 47e2cf4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
GATE_ENABLED=true
GATE_URL="https://gate.example.com/"
GATE_CLIENT_ID=3
GATE_CLIENT_SECRET=client_secret
GATE_KEY=
GATE_REDIRECT_URL="http://localhost/auth/callback"
GATE_AUTHORIZE_URL="http://localhost:8000/oauth/authorize"
GATE_TOKEN_URL="http://localhost:8000/oauth/token"
GATE_USER_URL="http://localhost:8000/api/user"

22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,28 @@ composer require looxis/gate

## Usage


To register your provider, add it to the array into `config/app.php` file:
```php
'providers' => [
// Other Service Providers

\Looxis\Gate\GateServiceProvider::class
],
```


Add some properties to your `.env` file (see .env.example)
```php
GATE_ENABLED=true
GATE_URL="https://gate.example.com/"
GATE_CLIENT_ID=3
GATE_CLIENT_SECRET=client_secret
```

Also you can publish the config file with this artisan command:
``` php
// Usage description here
php artisan vendor:publish --tag=gate-config
```

### Testing
Expand Down
7 changes: 6 additions & 1 deletion src/GateServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Support\ServiceProvider;
use Laravel\Socialite\Contracts\Factory;
use Laravel\Socialite\Facades\Socialite;


class GateServiceProvider extends ServiceProvider
Expand Down Expand Up @@ -56,11 +57,15 @@ public function register()
$this->mergeConfigFrom(__DIR__.'/../config/gate.php', 'gate');
// Register the main class to use with the facade

$this->app->bind('gate', function () {
return Socialite::driver('gate');
});

$this->app->resolving(Factory::class, function ($socialite) {
$socialite->extend(
'gate',
function ($app) use ($socialite) {
$config = config_path('gate.php');
$config = config('gate');
return $socialite->buildProvider(GateProvider::class, $config);
}
);
Expand Down

0 comments on commit 47e2cf4

Please sign in to comment.