PHP code example of gigabait / laravel-sso

1. Go to this page and download the library: Download gigabait/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/ */

    

gigabait / laravel-sso example snippets


use Illuminate\Encryption\Encrypter;

public function redirectToAppB()
{
    $user = Auth::user();
    $authMarkerData = [
        'email' => $user->email,
        'secret_key' => config('sso.secret_key')
    ];

    $key = config('sso.secret_key');
    $cipher = config('app.cipher');
    $encrypter = new Encrypter($key, $cipher);
    $token = json_encode($authMarkerData);
    $encryptedToken = $encrypter->encrypt($token);

    header("Location: https://app-b.example.com/sso-login?token=" . urlencode($encryptedToken));
}
bash
php artisan vendor:publish --tag=sso