aksesmaster / sso-client-php
Client SDK for SSO Aksesmaster (OAuth2 Authorization Code Flow) — framework-agnostic PHP, with optional Laravel integration
dev-main
2026-08-17 11:14 UTC
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
This package is auto-updated.
Last update: 2026-08-17 11:14:56 UTC
README
Framework-agnostic PHP client SDK for SSO Aksesmaster — implements the OAuth2 Authorization Code flow, and includes an optional Laravel service provider (auto-discovered).
Install
composer require aksesmaster/sso-client-php
Usage (plain PHP)
use Aksesmaster\SsoClient\SsoClient; $client = new SsoClient( baseUrl: 'https://sso.aksesmaster.com', clientId: getenv('SSO_CLIENT_ID'), clientSecret: getenv('SSO_CLIENT_SECRET'), redirectUri: 'https://app-kamu.com/callback', ); // 1. Redirect user to start login header('Location: ' . $client->buildAuthorizeUrl($state)); // 2. In your callback handler $token = $client->exchangeCodeForToken($_GET['code']); // 3. Fetch the member's profile $member = $client->getMemberInfo($token['access_token']);
Usage (Laravel)
The service provider is auto-discovered. Configure config/services.php:
'sso' => [ 'base_url' => env('SSO_URL'), 'client_id' => env('SSO_CLIENT_ID'), 'client_secret' => env('SSO_CLIENT_SECRET'), 'redirect' => env('SSO_REDIRECT_URI'), ],
Then resolve Aksesmaster\SsoClient\SsoClient from the container, or inject it via constructor.
Single Logout Webhooks
If you configure a Logout Webhook URL for your Domain in the SSO admin panel, verify incoming requests with:
$client->verifyLogoutWebhookSignature($rawBody, $_SERVER['HTTP_X_SIGNATURE']);
Full protocol reference: https://sso.aksesmaster.com/docs