PHP code example of waglpz / google-sso

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

    

waglpz / google-sso example snippets


    $config = O = new \GoogleSSO\GoogleSSO($config);
    $authorizationCodeUrl = $googleSSO->createAuthUrl();
    // Go to the $authorizationCodeUrl and select account you will authenticate against.
    // these will redirect you to defined/known redirect URI and a PHP script will use the code which sends back from Google.
    $accountData = $googleSSO->fetchAccountDataUsingAuthorizationCode($_GET['code']);
    // $accountData contains necessary information if one was founded by google