定制 phpnexus/oauth2-freee 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

phpnexus/oauth2-freee

Composer 安装命令:

composer require phpnexus/oauth2-freee

包简介

Freee OAuth 2.0 support for the PHP League's OAuth 2.0 Client

README 文档

README

Actions Status Coverage Status License Version Downloads

This package provides Freee OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Installation

To install, use composer:

composer require phpnexus/oauth2-freee

Usage

Usage is the same as The League's OAuth client, using \PhpNexus\OAuth2\Client\Provider\Freee as the provider.

Authorization Code Flow

$provider = new PhpNexus\OAuth2\Client\Provider\Freee([
    'clientId'          => '{freee-app-client-id}',
    'clientSecret'      => '{freee-app-client-secret}',
    'redirectUri'       => 'https://example.com/redirect-url'
]);

For further usage of this package please refer to the core package documentation on "Authorization Code Grant".

Refreshing a Token

Once your application is authorized, you can refresh an expired token using a refresh token rather than going through the entire process of obtaining a brand new token. To do so, simply reuse this refresh token from your data store to request a refresh.

$existingAccessToken = getAccessTokenFromYourDataStore();

if ($existingAccessToken->hasExpired()) {
    $newAccessToken = $provider->getAccessToken('refresh_token', [
        'refresh_token' => $existingAccessToken->getRefreshToken()
    ]);

    // Purge old access token and store new access token to your data store.
}

For further usage of this package please refer to the core package documentation on "Refreshing a Token".

Testing

$ ./vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-05