Feeds OAuth provides a new Feeds fetcher plugin that performs OAuth or OAuth 2.0 authorization before requesting a feed.

INSTALLATION

  • Requires PHP 5.3+
  • Install php-proauth in sites/all/libraries using the following:
    git clone https://github.com/infojunkie/php-proauth.git

USAGE

  • Obtain standard OAuth information from provider: consumer key, consumer secret, request token URL, access token URL, authorize URL.
  • Create a new Feeds importer and select the fetcher to be of type OAuthHTTPFetcher or OAuth2HTTPSFetcher.
  • In the fetcher settings, enter the OAuth information above, as well as a unique site identifier that represents the provider (e.g., twitter).
  • When saved, the configuration screen will show you a callback URL: add it to the provider's configuration for your Drupal site.
  • Associate the new importer with a content type.
  • When you create a new node of this content type, the form will warn you that you haven't received an authorization from the provider. Click the link to do so and complete the authentication steps.
  • OAuth 2.0: you can also enter a scope argument that gets sent during authorization, to request special permissions from the provider.
  • You're now ready to create new feeds from your protected data!

COMPATIBILITY WITH OTHER OAUTH MODULES

  • Other modules, such as Twitter Signin, already provide OAuth authentication and store tokens in their own tables. Feeds OAuth must be able to retrieve the tokens stored by those third party modules. To do so, a new hook hook_feeds_oauth_authenticator is used. Here's the implementation for Twitter Signin:
    <?php
    function twitter_feeds_oauth_authenticator() {
      return array(
    'twitter_get_tokens' => 'Twitter');
    }
    function
    twitter_get_tokens($uid, $site_id) {
      return
    db_fetch_array(db_query("SELECT oauth_token, oauth_token_secret FROM {twitter_account} WHERE uid = %d", $uid));
    }
    ?>
  • Feeds OAuth is known to be incompatible with OAuth module due to a naming conflict in their respective OAuth libraries. This will be fixed when Feeds OAuth moves to using Guzzle to consume feeds.

Project Information

Downloads