You are here

function oauth_common_callback_request_token in OAuth 1.0 7.3

Same name and namespace in other branches
  1. 6.3 oauth_common.pages.inc \oauth_common_callback_request_token()
  2. 7.4 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
Implements hook_menu().

File

./oauth_common.pages.inc, line 357
Page callbacks for OAuth module

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_add_http_header('Status', '401 Unauthorized: ' . $e
      ->getMessage());
    drupal_add_http_header('WWW-Authenticate', sprintf('OAuth realm="%s"', url('', array(
      'absolute' => TRUE,
    ))));
  }
}