PHP code example of ijagjeet / laravel-sso

1. Go to this page and download the library: Download ijagjeet/laravel-sso library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ijagjeet / laravel-sso example snippets


'api' => [
    'bindings',
    \Illuminate\Session\Middleware\StartSession::class,
],

public function broker()
    {
        return $this->belongsToMany(Broker::class)
                    ->where('deleted_at', NULL)
                    ->withTimestamps();
    }

$user->broker()->sync($brokers)

protected $middlewareGroups = [
        'web' => [
            ...
            \IJagjeet\LaravelSSO\Middleware\SSOAutoLogin::class,
        ],

        'api' => [
            ...
        ],
    ];

protected function attemptLogin(Request $request)
{
    $broker = new \IJagjeet\LaravelSSO\LaravelSSOBroker;
    
    $credentials = $this->credentials($request);
    return $broker->login($credentials[$this->username()], $credentials['password']);
}

public function logout(Request $request)
{
    $broker = new \IJagjeet\LaravelSSO\LaravelSSOBroker;
    
    $broker->logout();
    
    $this->guard()->logout();
    
    $request->session()->invalidate();
    
    return redirect('/');
}
shell
$ php artisan vendor:publish --provider="IJagjeet\LaravelSSO\SSOServiceProvider"
shell
$ php artisan migrate --path=vendor/ijagjeet/laravel-sso/database/migrations
shell
$ php artisan sso:broker:create {name}
shell
$ php artisan vendor:publish --provider="IJagjeet\LaravelSSO\SSOServiceProvider"