phidias / oauth.api
OAuth authentication endpoints
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 7
Forks: 0
Open Issues: 0
pkg:composer/phidias/oauth.api
Requires
- firebase/php-jwt: 5.5.1
This package is not auto-updated.
Last update: 2025-10-25 23:48:05 UTC
README
Setup
Import OAuth endpoints in your server
Server::import("vendor/phidias/oauth.api");
Configuration
Define a credential validation function that takes username and password and return payload data.
Return false or throw exceptions when authentication fails
Phidias\Oauth\Controller::addCredentialsValidator(function ($username, $password) {
// do your voodoo
return $payload;
});
Access the token payload globally from you application
use Phidias\Oauth\Token;
$payload = Token::getPayload();
if ($payload === null) {
die("you are not authenticated");
}
echo "Welcome back, {$payload->firstName}!";