You are here

function oauth_common_get_request_token in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 oauth_common.module \oauth_common_get_request_token()
  2. 7.3 oauth_common.module \oauth_common_get_request_token()

Gets a request token from a oauth provider and returns the authorization url. The request token is saved in the database.

Parameters

OAuthToken $consumer_token: The consumer token to use

string $request_endpoint: Optional. Pass a custom endpoint if needed. Defaults to '/oauth/request_token'.

string $authorize_endpoint: Optional. Pass a custom endpoint if needed. Defaults to '/oauth/authorize'.

Return value

string The url that the client should be redirected to to authorize the request token.

File

./oauth_common.module, line 406

Code

function oauth_common_get_request_token($consumer_token, $request_endpoint = '/oauth/request_token', $authorize_endpoint = '/oauth/authorize') {
  $client = new DrupalOAuthClient($consumer_token);
  $request_token = $client
    ->getRequestToken($request_endpoint);
  $request_token
    ->write();
  return $client
    ->getAuthorizationUrl($authorize_endpoint);
}