You are here

function oauth_authorize_access in OAuth 1.0 6

Authorize access from access token

Used by services that implement oauth access. This function also sets the active user to the person who authorized the access token.

Parameters

key: Access token key

secret: Access token secret

Return value

The user ID assigned to the token if successful, or null if unsuccessful.

File

./oauth.module, line 339

Code

function oauth_authorize_access($key, $secret) {
  global $user;
  $result = db_query("SELECT * FROM {oauth_token} WHERE type='access' AND token_key = '%s' AND token_secret='%s'", $key, $secret);
  if ($object = db_fetch_object($result)) {
    $user = user_load($object->uid);
    return $user->uid;
  }
  return null;
}