\EasyWeChat\OpenPlatformAuthorizerAccessToken

Class AuthorizerAccessToken.

AuthorizerAccessToken is responsible for the access token of the authorizer, the complexity is that this access token also requires the refresh token of the authorizer which is acquired by the open platform authorizer process.

This completely overrides the original AccessToken.

Summary

Methods
Properties
Constants
__construct()
getToken()
setToken()
getAppId()
getSecret()
setCache()
getCache()
setQueryName()
getQueryName()
getQueryFields()
getTokenFromServer()
getHttp()
setHttp()
setPrefix()
setCacheKey()
getCacheKey()
No public properties found
API_TOKEN_GET
renewAccessToken()
$appId
$secret
$cache
$cacheKey
$http
$queryName
$tokenJsonKey
$prefix
$authorizer
N/A
No private methods found
No private properties found
N/A

Constants

API_TOKEN_GET

API_TOKEN_GET = 'https://api.weixin.qq.com/cgi-bin/token'

Properties

$appId

$appId : string

App ID.

Type

string

$secret

$secret : string

App secret.

Type

string

$cacheKey

$cacheKey : string

Cache Key.

Type

string

$queryName

$queryName : string

Query name.

Type

string

$tokenJsonKey

$tokenJsonKey : string

Response Json key name.

Type

string

$prefix

$prefix : string

Cache key prefix.

Type

string

Methods

__construct()

__construct(string  $appId, \EasyWeChat\OpenPlatform\Authorizer  $authorizer) 

AuthorizerAccessToken constructor.

Parameters

string $appId
\EasyWeChat\OpenPlatform\Authorizer $authorizer

getToken()

getToken(boolean  $forceRefresh = false) : string

Get token from WeChat API.

Parameters

boolean $forceRefresh

Returns

string

setToken()

setToken(string  $token, integer  $expires = 7200) : $this

设置自定义 token.

Parameters

string $token
integer $expires

Returns

$this

getAppId()

getAppId() : string

Return the AuthorizerAppId.

Returns

string

getSecret()

getSecret() : string

Return the secret.

Returns

string

setQueryName()

setQueryName(string  $queryName) : $this

Set the query name.

Parameters

string $queryName

Returns

$this

getQueryName()

getQueryName() : string

Return the query name.

Returns

string

getQueryFields()

getQueryFields() : array

Return the API request queries.

Returns

array

getTokenFromServer()

getTokenFromServer() : string

Get the access token from WeChat server.

Throws

\EasyWeChat\Core\Exceptions\HttpException

Returns

string

setHttp()

setHttp(\EasyWeChat\Core\Http  $http) : $this

Set the http instance.

Parameters

\EasyWeChat\Core\Http $http

Returns

$this

setPrefix()

setPrefix(string  $prefix) : $this

Set the access token prefix.

Parameters

string $prefix

Returns

$this

setCacheKey()

setCacheKey(string  $cacheKey) : $this

Set access token cache key.

Parameters

string $cacheKey

Returns

$this

getCacheKey()

getCacheKey() : string

Get access token cache key.

Returns

string —

$this->cacheKey

renewAccessToken()

renewAccessToken() : string

Refresh authorizer access token.

Returns

string