承接 chocofamilyme/oauth2-client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

chocofamilyme/oauth2-client

Composer 安装命令:

composer require chocofamilyme/oauth2-client

包简介

PHP OAuth2.0 client authentication library

README 文档

README

OAuth 2.0 authentication client. It provides multiple grant types, using which you can get authentication data.

Installation

composer require chocofamilyme/oauth2-client

Usage

Grand type "password"

<?php
use Chocofamilyme\OAuth2\Client\Authentication;
use Chocofamilyme\OAuth2\Client\GrandTypes\PasswordGrandType;

$grantType = new PasswordGrandType('client_id', 'username', 'password');
$oauth2 = new Authentication($grantType, 'http://oauth.server.com/auth/token');
$authData = $oauth2->getAuthData();
var_dump($authData);

Grand type "client_credentials"

<?php
use Chocofamilyme\OAuth2\Client\Authentication;
use Chocofamilyme\OAuth2\Client\GrandTypes\ClientCredentialsGrandType;

$grantType = new ClientCredentialsGrandType('client_id', 'client_secret');
$oauth2 = new Authentication($grantType, 'http://oauth.server.com/auth/token');
$authData = $oauth2->getAuthData();
var_dump($authData);

Extending

  • You can also extend this library with your grant types, see GrantTypeInterface.
  • You can also use your own http client, it just has to implement HttpClientInterface
  • If your OAuth 2.0 server gives the response not in the format this library can understand, just write your own response class which has to implement ResponseInterface

Every custom module can then be used in the constructor of the Authentication class

new \Chocofamilyme\OAuth2\Client\Authentication(GrantTypeInterface $grantType, string $authTokenUrl, HttpClientInterface $httpClient = null, ResponseInterface $responseInterface = null)

统计信息

  • 总下载量: 814
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-12-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固