PHP code example of fly3949 / flarum-ext-sso

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

    

fly3949 / flarum-ext-sso example snippets


$email = '[email protected]';
$id = 1;
$username = 'example';
$now = Carbon::now()->timestamp;
$secret = env('FLARUM_SSO_KEY'); // for example: VRSW1xDk1e1gsC8zIOaOiJhg6xTKrqm4o6Gt7LAS

$data = [
    'email' => $email,
    'id' => $id,
    'username' => $username,
    'time' => $now,
    'signature' => hash_hmac('sha256', $email . $id . $username . $now, $secret)
];

$query = http_build_query($data);

return redirect('https://example.com/session/sso_login?' . $query);