You are here

public static function Client::loadToken in OAuth2 Client 7

Same name and namespace in other branches
  1. 7.2 src/Client.php \OAuth2\Client::loadToken()

Load the token data from the storage.

Parameters

$key: The token identifier.

Return value

array The token data stored for the given key, or an empty token if such a key does not exist.

3 calls to Client::loadToken()
Client::clearToken in ./oauth2_client.inc
Clear the token data.
Client::__construct in ./oauth2_client.inc
Construct an OAuth2\Client object.
oauth2_client_get_token in ./oauth2_client.module
Returns the access token of the oauth2_client with the given $id.

File

./oauth2_client.inc, line 140
Class OAuth2\Client

Class

Client
The class OAuth2\Client is used to get authorization from an oauth2 server. Its only goal is to get an access_token from the oauth2 server, so the only public function (besides the constructor) is getAccessToken().

Namespace

OAuth2

Code

public static function loadToken($key) {
  if (isset($_SESSION['oauth2_client']['token'][$key])) {
    return $_SESSION['oauth2_client']['token'][$key];
  }
  else {
    return static::emptyToken();
  }
}