function lookup_token($consumer, $token_type, $token) { $token = _lookup_token($token, $token_type); /* if ($token_type == 'access') { $record = array( 'id' => $token->id, 'last_used' => time(), ); drupal_write_record('brukar_token', $record, 'id'); } */ return new BrukarServerToken($token->token_key, $token->token_secret, $token->id, $token->uid); }
function brukar_server_oauth_authorize() { global $user; if (isset($_SESSION['oauth_token'])) { $_GET['oauth_token'] = $_SESSION['oauth_token']; unset($_SESSION['oauth_token']); } if (isset($_GET['oauth_token'])) { $token = _lookup_token($_GET['oauth_token'], 'request'); if ($token !== FALSE) { if ($user->uid != 0) { $token->uid = $user->uid; drupal_write_record('brukar_token', $token, 'id'); drupal_goto($token->callback . '?oauth_token=' . $token->token_key); } else { $_SESSION['oauth_token'] = $_GET['oauth_token']; } } } drupal_goto('<front>'); }