Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adoy/php-oauth2
Light PHP wrapper for the OAuth 2.0 protocol (based on OAuth 2.0 Authorization Protocol draft-ietf-oauth-v2-15)
https://github.com/adoy/php-oauth2
Last synced: 24 days ago
JSON representation
Light PHP wrapper for the OAuth 2.0 protocol (based on OAuth 2.0 Authorization Protocol draft-ietf-oauth-v2-15)
- Host: GitHub
- URL: https://github.com/adoy/php-oauth2
- Owner: adoy
- License: lgpl-2.1
- Created: 2011-04-15T22:53:39.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T13:42:10.000Z (7 months ago)
- Last Synced: 2024-10-03T10:51:38.750Z (about 1 month ago)
- Language: PHP
- Homepage:
- Size: 73.2 KB
- Stars: 392
- Watchers: 35
- Forks: 152
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Light PHP wrapper for the OAuth 2.0
[![Latest Stable Version](https://poser.pugx.org/adoy/fastcgi-client/v/stable)](https://packagist.org/packages/adoy/fastcgi-client)
[![GitHub](https://img.shields.io/github/license/adoy/PHP-OAuth2)](LICENSE)
[![Total Downloads](https://poser.pugx.org/adoy/fastcgi-client/downloads)](https://packagist.org/packages/adoy/fastcgi-client)## How can I use it ?
```php
getAuthenticationUrl(AUTHORIZATION_ENDPOINT, REDIRECT_URI);
header('Location: ' . $auth_url);
die('Redirect');
}
else
{
$params = array('code' => $_GET['code'], 'redirect_uri' => REDIRECT_URI);
$response = $client->getAccessToken(TOKEN_ENDPOINT, 'authorization_code', $params);
parse_str($response['result'], $info);
$client->setAccessToken($info['access_token']);
$response = $client->fetch('https://graph.facebook.com/me');
var_dump($response, $response['result']);
}
```## How can I add a new Grant Type ?
Simply write a new class in the namespace OAuth2\GrantType. You can place the class file under GrantType.
Here is an example :```php
getAccessToken(TOKEN_ENDPOINT, 'my_custom_grant_type', $params);
```## LICENSE
This Code is released under the GNU LGPL
Please do not change the header of the file(s).
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.See the GNU Lesser General Public License for more details.