jonathanraftery / oauth-bullhorn
Bullhorn OAuth 2.0 客户端提供程序,用于 PHP League OAuth2-Client
dev-master / 1.0.x-dev
2019-11-18 13:54 UTC
Requires
- ext-json: *
- league/oauth2-client: ^2.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: ~2.0
This package is auto-updated.
Last update: 2024-09-19 22:36:24 UTC
README
本软件包为 PHP League 的 OAuth 2.0 客户端 提供Bullhorn OAuth 2.0 支持。
安装
要安装,请使用 composer
composer require jonathanraftery/oauth2-bullhorn
使用方法
使用方法与 The League 的 OAuth 客户端相同,使用 \JonathanRaftery\OAuth2\Client\Provider\Bullhorn
作为提供程序。
授权码流
$provider = new JonathanRaftery\OAuth2\Client\Provider\Bullhorn([ 'clientId' => '{bullhorn-client-id}', 'clientSecret' => '{bullhorn-client-secret}', 'redirectUri' => 'https://example.com/callback-url' ]);
有关本软件包的进一步使用,请参阅 核心软件包文档中的“授权码授予”。
刷新令牌
一旦您的应用程序获得授权,您可以使用刷新令牌来刷新已过期的令牌,而不是通过整个获取全新令牌的过程。为此,只需从您的数据存储中重复使用此刷新令牌来请求刷新。
$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. }
有关本软件包的进一步使用,请参阅 核心软件包文档中的“刷新令牌”。
测试
$ ./vendor/bin/phpunit
鸣谢
许可
MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件。