Omniuth的TripIt策略

时间:2012-01-31 23:24:11

标签: ruby-on-rails omniauth

我是Rails的新手!我正在使用Omniauth,到目前为止,没有人做过任何TripIt策略。

TripIt使用oAuth 1.0,我正在使用omniauth-oauth!

到目前为止,我有这段代码:

require 'omniauth-oauth'
require 'multi_xml'

module OmniAuth
  module Strategies
    class Tripit < OmniAuth::Strategies::OAuth
      option :name, "tripit"

      option :client_options, {
          :site => 'https://api.tripit.com',
          :request_token_path => '/oauth/request_token',
          :access_token_path => '/oauth/access_token',
          :authorize_path => '/oauth/confirm_access'
      }

      uid do
        request.params['username']
      end

      info do
        {
            :email => raw_info['feed']['entry']['content']['Email']['EmailAddress']
        }
      end

      extra do
        { 'raw_info' => raw_info }
      end

      def raw_info
        #@raw_info ||= MultiXml.parse(access_token.get("https://api.constantcontact.com/ws/customers/" + request.params['username'] + "/settings/emailaddresses").body)
      end
    end
  end
end

我收到错误:

consumer key not present in request

对此有何帮助?

1 个答案:

答案 0 :(得分:0)

看看:omniauth-tripit。它刚刚发布。