class OAuthClient

Class OAuthClient

Constants

AUTHORIZATION_URI

TOKEN_URI

REVOKE_URI

PERSISTENT_DATA_STATE_KEY

Methods

__construct(YfyHttpClient $httpClient, PersistentDataHandler $persistentDataHandler = null, RandomStringGenerator $randomStringGenerator = null)

OAuthClient constructor.

execute(YfyRequest $yfyRequest)

执行所有授权请求, 并且进行错误处理

mixed
refreshToken(string $refreshToken)

刷新token

mixed
getTokenByPasswordFlow(string $username, string $password)

通过密码模式获取token

revokeToken($token)

取消一个token的授权(对应的refresh token也会失效)

string
getAuthorizationUrl(string|null $state = null)

获取授权url

mixed
finishAuthorizationCodeFlow(string|null $code = null, string|null $state = null)

结束授权码流程

Details

at line 54
__construct(YfyHttpClient $httpClient, PersistentDataHandler $persistentDataHandler = null, RandomStringGenerator $randomStringGenerator = null)

OAuthClient constructor.

Parameters

YfyHttpClient $httpClient
PersistentDataHandler $persistentDataHandler
RandomStringGenerator $randomStringGenerator

at line 68
protected YfyRawResponse execute(YfyRequest $yfyRequest)

执行所有授权请求, 并且进行错误处理

Parameters

YfyRequest $yfyRequest

Return Value

YfyRawResponse

Exceptions

YfySdkException

at line 117
mixed refreshToken(string $refreshToken)

刷新token

Parameters

string $refreshToken

Return Value

mixed

Exceptions

YfySdkException

at line 157
mixed getTokenByPasswordFlow(string $username, string $password)

通过密码模式获取token

Parameters

string $username 密码模式用户用户名
string $password 密码模式用户密码

Return Value

mixed

Exceptions

YfySdkException

at line 176
revokeToken($token)

取消一个token的授权(对应的refresh token也会失效)

Parameters

$token

Exceptions

YfySdkException

at line 192
string getAuthorizationUrl(string|null $state = null)

获取授权url

Parameters

string|null $state

Return Value

string

Exceptions

YfySdkException

at line 219
mixed finishAuthorizationCodeFlow(string|null $code = null, string|null $state = null)

结束授权码流程

Parameters

string|null $code
string|null $state

Return Value

mixed

Exceptions

YfySdkException