logicly/easy-oauth-client
最新稳定版本:v1.0.1
Composer 安装命令:
composer require logicly/easy-oauth-client
包简介
Multi purpose OAuth2 client to use in Laravel
README 文档
README
Multipurpose OAuth2 client, configurable for a sleuth of providers through the config file.
Installation
Via Composer
$ composer require logicly/easy-oauth-client
Usage
Publish the config
$ php artisan provider:publish --provider="Logicly\EasyOAuthClient\EasyOAuthClientServiceProvider"
Configure the config using the provided example.
Then use the package as follows:
use Logicly\EasyOAuthClient\Client; // ... $oAuthClient = new Client("providername"); // Returns array defined in config $response = $oAuthClient->getToken($code); //Returns array defined in config $response = $oAuthClient->getInfo($accesstoken); //Returns array defined in config $response = $oAuthClient->refreshToken($refreshtoken);
Config
Example of config provided, edit values to match provider spec:
<?php return [ 'provider1' => [ 'client_id' => '1234', 'client_secret' => '12345', 'redirect_uri' => 'https://www.example.com/oauth2/provider1', 'token' => [ 'url' => 'https://login.provider.example.com/oauth2/token', 'method' => 'POST', 'grant_type' => 'authorization_code', 'fields' => [ 'access_token' => 'access_token', 'expires_in' => 'expires_in', 'refresh_token' => 'refresh_token', ], 'auth' => 'body', ], 'refresh' => [ 'url' => 'https://login.provider.example.com/oauth2/token', 'method' => 'POST', 'grant_type' => 'authorization_code', 'fields' => "*", 'auth' => 'body', ], 'info' => [ 'url' => 'https://login.provider.example.com/oauth2/metadata', 'method' => 'GET', 'fields' => [ 'metadata1', 'metadata2', ], ], ], 'provider2' => ['...'], ];
Change log
Please see the changelog for more information on what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email author email instead of using the issue tracker.
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-16