You are here

private function OAuthServer::get_token in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 6 OAuth.php \OAuthServer::get_token()
  2. 7.3 lib/OAuth.php \OAuthServer::get_token()

try to find the token for the provided request's token key

2 calls to OAuthServer::get_token()
OAuthServer::fetch_access_token in lib/OAuth.php
process an access_token request returns the access token on success
OAuthServer::verify_request in lib/OAuth.php
verify an api call, checks all the parameters

File

lib/OAuth.php, line 643
OAuth 1.0 server and client library.

Class

OAuthServer

Code

private function get_token($request, $consumer, $token_type = "access") {
  $token_field = $request instanceof OAuthRequest ? $request
    ->get_parameter('oauth_token') : NULL;
  if (!empty($token_field)) {
    $token = $this->data_store
      ->lookup_token($consumer, $token_type, $token_field);
    if (!$token) {
      throw new OAuthException("Invalid {$token_type} token: {$token_field}");
    }
  }
  else {
    $token = new OAuthToken('', '');
  }
  return $token;
}