README.md 1.04 KB

SSO Riau

SSO Riau

Construct:

$this->clientId = '';   // 3rd Party client Id
$this->clientSecret = '';   // 3rd Party client secret
$this->redirectUri = '';  // 3rd Party url redirect or url to handle callback
$this->targetUri = 'https://sso.riau.go.id/';    // SSO Riau portal

Check SSO session :

use SsoRiau\SsoClientLibrary;
$objSso = new SsoClientLibrary();
$objSso->ssoRequest();

Consume SSO session :

use SsoRiau\SsoClientLibrary;
$objSso = new SsoClientLibrary();
$data_access_token = $objSso->ssoCallback();
if (!empty($data_access_token)) {
    $data_access_token = json_decode($data_access_token);
    $access_token = $data_access_token->access_token; // store access_token within the session if needed?
}

if ($access_token != '') {
    //fetch ssoUserInfo
    $ssoUserInfo = $objSso->ssoUserInfo($access_token);
    $ssoUserInfo = json_decode($ssoUserInfo);
    $email = $ssoUserInfo->email;
}

$url_back = {return_url};
$objSso = new SsoClientLibrary();
$objSso->ssoLogout($url_back);