chris-moreton / oauth-server-php-client
API Wrapper for the Netsensia authentication server
Installs: 1 483
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^6.2
- vlucas/phpdotenv: ^2.4
Requires (Dev)
- phpspec/phpspec: ~2.0
README
This is a PHP client for the Netsensia authentication server (chris-moreton/oauth-server).
Add to project using Composer
composer require chris-moreton/oauth-server-php-client
Usage
$client = new Client($apiUri, $token);
oAuth2 Password grant
$response = $client->passwordGrant($email, $password, $clientId, $clientSecret, $scope)
Client Credentials Grant
$response = $client->clientGrant($clientId, $clientSecret, $scope)
Password Check
$response = $client->verifyPassword($email, $password)
Create User
$response = $client->createUser(['email'=>'test@example.com', 'name'=>'Test', 'password'=>'secret'])
Get User Details
$response = $client->getUserDetails($userId)
Update User
$response = $client->updateUserDetails($userId, ['email'=>'test@example.com', 'name'=>'Test', 'password'=>'secret', 'remember_token'=>'abcd1234'])
Get User Token Details
$response = $client->userTokenDetails()
Get Scopes from Client Credentials Token
$response = $client->tokenScopes()
Development
Clone the repo and compose
git clone git@github.com:chris-moreton/oauth-server-php-client
cd oauth-server-php-client
composer install
Run the tests
cp spec/.env.example spec/.env
and fill in the values.
Then you can run the tests:
bin/phpspec run --format=pretty -vvv --stop-on-failure