mimso / oauth-client-php
This package is abandoned and no longer maintained.
No replacement package was suggested.
Authentification with social network
1.1
2021-06-13 23:20 UTC
Requires
- php: ^7.3 || ^8.0
- guzzlehttp/guzzle: ^7.3
README
Requirements
- GuzzleHTTP
- PHP >= 7.3
Installation
Download and install Composer by following the official instructions.
For usage, see the documentation.
Run this command to install the package with composer
composer require mimso/oauth-client-php
Usage
Example for google oauth API.
$oauth = new \Mnt\OAuth\OAuth([ 'clientId' => '0000', 'clientSecret' => '0000', 'redirectUri' => 'https://my.url/', 'authEndpoint' => 'https://accounts.google.com/o/oauth2/v2/auth', 'accessTokenEndpoint' => 'https://oauth2.googleapis.com/token', 'userInfoEndpoint' => 'https://openidconnect.googleapis.com/v1/userinfo', 'scope' => ['openid', 'email', 'profile'], ]); if(isset($_GET['code'])) { $accessToken = $oauth->getToken($_GET['code']); $user = $oauth->getResource(); var_dump($user) //logged } else { echo "<a href=". $oauth->getAuthUrl() .">login with google</a>"; }
License
oauth-client-php is available under MIT LICENSE.