You are here

public function DrupalOAuthDataStore::lookup_consumer in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 6 oauth.module \DrupalOAuthDataStore::lookup_consumer()
  2. 7.4 includes/DrupalOAuthDataStore.inc \DrupalOAuthDataStore::lookup_consumer()
  3. 7.3 includes/DrupalOAuthDataStore.inc \DrupalOAuthDataStore::lookup_consumer()

Check if consumer exists from a given consumer key.

Parameters

string $consumer_key: The consumer key.

bool $provider_consumer: Whether the consumer should be a provider consumer

Return value

OAuthConsumer The consumer

Throws

OAuthException An exception is thrown when the consumer cannot be found

Overrides OAuthDataStore::lookup_consumer

File

includes/DrupalOAuthDataStore.inc, line 25

Class

DrupalOAuthDataStore
Database abstraction class

Code

public function lookup_consumer($consumer_key, $provider_consumer = TRUE) {
  $consumer = DrupalOAuthConsumer::loadProviderByKey($consumer_key);
  if (!$consumer) {
    throw new OAuthException('Consumer not found');
  }
  return $consumer;
}