You are here

function oauth_common_callback_request_token in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.pages.inc \oauth_common_callback_request_token()
  2. 7.3 oauth_common.pages.inc \oauth_common_callback_request_token()

Generate a request token from the request.

1 string reference to 'oauth_common_callback_request_token'
oauth_common_menu in ./oauth_common.module
Implementation of hook_menu().

File

./oauth_common.pages.inc, line 327

Code

function oauth_common_callback_request_token() {
  try {
    $req = DrupalOAuthRequest::from_request();
    $context = oauth_common_context_from_request($req);
    if (!$context) {
      throw new OAuthException('No OAuth context found');
    }
    $server = new DrupalOAuthServer($context);
    print $server
      ->fetch_request_token($req);
  } catch (OAuthException $e) {
    drupal_set_header('HTTP/1.0 401 Unauthorized: ' . $e
      ->getMessage());
    drupal_set_header(sprintf('WWW-Authenticate: OAuth realm="%s"', url('', array(
      'absolute' => TRUE,
    ))));
  }
}