Skip to content

Commit

Permalink
Make some compatible. (#542)
Browse files Browse the repository at this point in the history
* add support wechat open platform oauth.

* Compatibility.

* Compatibility.

* Compatibility.
  • Loading branch information
mingyoung authored and overtrue committed Dec 9, 2016
1 parent 859bb43 commit 058da32
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Core/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ class AccessToken
*/
protected $queryName = 'access_token';

/**
* Response Json key name.
*
* @var string
*/
protected $tokenJsonKey = 'access_token';

/**
* Cache key prefix.
*
Expand Down Expand Up @@ -112,9 +119,9 @@ public function getToken($forceRefresh = false)
$token = $this->getTokenFromServer();

// XXX: T_T... 7200 - 1500
$this->getCache()->save($cacheKey, $token['access_token'], $token['expires_in'] - 1500);
$this->getCache()->save($cacheKey, $token[$this->tokenJsonKey], $token['expires_in'] - 1500);

return $token['access_token'];
return $token[$this->tokenJsonKey];
}

return $cached;
Expand Down

0 comments on commit 058da32

Please sign in to comment.