You are here

function flickrapi_oauth_token_verify in Flickr API 7

Same name and namespace in other branches
  1. 7.2 flickrapi.module \flickrapi_oauth_token_verify()

Verification callback to check the token we received from Flickr

Handles the last step in the authentication proces:

  • Exchanging the Request Token for an Access Token

See http://www.flickr.com/services/api/auth.oauth.html

1 call to flickrapi_oauth_token_verify()
flickrapi_oauth_authenticate in ./flickrapi.admin.inc
Fetch a token from Flickr using the key & secret the user entered.

File

./flickrapi.module, line 177
FlickAPI integration module.

Code

function flickrapi_oauth_token_verify() {
  module_load_include('module', 'oauth_common');
  $consumer = DrupalOAuthConsumer::load(variable_get('flickrapi_api_key', ''), FALSE);
  $request_token = DrupalOAuthToken::loadByKey($_GET['oauth_token'], $consumer, OAUTH_COMMON_TOKEN_TYPE_REQUEST);
  $client = new DrupalOAuthClient($consumer, $request_token);
  $access_token = $client
    ->getAccessToken('https://www.flickr.com/services/oauth/access_token', array(
    'verifier' => $_GET['oauth_verifier'],
  ));
  $request_token
    ->delete();
  drupal_set_message(t('Succesfully verified'));
  drupal_goto('admin/config/media/flickrapi');
}