public function DrupalOAuthDataStore::lookup_token in OAuth 1.0 7.4
Same name and namespace in other branches
- 6.3 includes/DrupalOAuthDataStore.inc \DrupalOAuthDataStore::lookup_token()
- 6 oauth.module \DrupalOAuthDataStore::lookup_token()
- 7.3 includes/DrupalOAuthDataStore.inc \DrupalOAuthDataStore::lookup_token()
Check if the token exists.
Parameters
OAuthConsumer $consumer: The consumer.
string $token_type: The type of the token: 'request' or 'access'.
string $token: The token key.
Return value
DrupalOauthToken The matching token
Throws
OAuthException An exception is thrown when the token cannot be found or doesn't match
Overrides OAuthDataStore::lookup_token
File
- includes/
DrupalOAuthDataStore.inc, line 47
Class
- DrupalOAuthDataStore
- Database abstraction class
Code
public function lookup_token($consumer, $token_type, $token) {
$type = $token_type == 'request' ? OAUTH_COMMON_TOKEN_TYPE_REQUEST : OAUTH_COMMON_TOKEN_TYPE_ACCESS;
$token = DrupalOAuthToken::loadByKey($token, $consumer, $type);
if (!$token) {
throw new OAuthException('Token not found');
}
return $token;
}