PHP code example of vnpas / sso-laravel

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

    

vnpas / sso-laravel example snippets


$returnUrl = '...'; // load URL from config

return VatsimSSO::login(
    $returnUrl,
    function($key, $secret, $url) {
        Session::put('vatsimauth', compact('key', 'secret'));
        return Redirect::to($url);
    },
    function($e) {
        throw $e; // Do something with the exception
    }
);

$session = Session::get('vatsimauth');

return VatsimSSO::validate(
    $session['key'],
    $session['secret'],
    Input::get('oauth_verifier'),
    function($user, $request) {
        // At this point we can remove the session data.
        Session::forget('vatsimauth');
        
        Auth::loginUsingId($user->id);
        return Redirect::home();
    },
    function($error) {
        throw $e; // Do something with the exception
    }
);