novay/sso-php

SSO-Samarinda Client for PHP Language.

1.0 2021-07-01 12:39 UTC

This package is auto-updated.

Last update: 2024-10-29 06:19:33 UTC


README

SSO-Samarinda Client for PHP Language.

Install

composer require novay/sso-php

Contoh Penggunaan

Untuk Login:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$properti = [
    'url' => 'https://sso.samarindakota.go.id', 
    'name' => 'XXX', 
    'secret' => 'XXX'
];

$broker = new \Novay\SsoPhp\Services\Broker($properti);
echo $broker->getLogin();

Untuk Get User Information:

<?php 

require __DIR__ . '/../vendor/autoload.php';

$properti = [
    'url' => 'https://sso.samarindakota.go.id', 
    'name' => 'XXX', 
    'secret' => 'XXX'
];

$broker = new \Novay\SsoPhp\Services\Broker($properti);
$user = $broker->getUser($_GET['code'], $_GET['uid'], $_GET['pwd']);

echo $user['id'];
echo $user['photo'];
echo $user['name'];
echo $user['email'];
echo $user['phone'];
echo $user['address'];
echo $user['gender'];
echo $user['date_birth'];
echo $user['number_id'];
echo $user['type_id'];
echo $user['level'];

// Silahkan lakukan penyimpanan session atau pembagian hak akses mandiri kedalam aplikasi client
// ...

Untuk Logout:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$properti = [
    'url' => 'https://sso.samarindakota.go.id', 
    'name' => 'XXX', 
    'secret' => 'XXX'
];

$broker = new \Novay\SsoPhp\Services\Broker($properti);
echo $broker->logout();