Sha256: 325de415da65e35707c47ee1970790472d31077425bff4f86e5421782f160e92
Contents?: true
Size: 1.72 KB
Versions: 1
Compression:
Stored size: 1.72 KB
Contents
require 'omniauth' module OmniAuth module Strategies class Ebay include OmniAuth::Strategy include EbayAPI args [:runame, :devid, :appid, :certid, :siteid, :apiurl] option :name, "ebay" option :runame, nil option :devid, nil option :appid, nil option :certid, nil option :siteid, nil option :apiurl, nil uid { raw_info['EIASToken'] } info do { :ebay_id => raw_info['UserID'], :ebay_token => @auth_token, :email => raw_info['Email'] } end extra do { :internal_return_to => request.params['internal_return_to'] || request.params[:internal_return_to] } end #1: We'll get to the request_phase by accessing /auth/ebay #2: Request from eBay a SessionID #3: Redirect to eBay Login URL with the RUName and SessionID def request_phase session_id = generate_session_id redirect ebay_login_url(session_id) rescue Exception => ex fail!("Failed to retrieve session id from ebay", ex) end #4: We'll get to the callback phase by setting our accept/reject URL in the ebay application settings(/auth/ebay/callback) #5: Request an eBay Auth Token with the returned username&secret_id parameters. #6: Request the user info from eBay def callback_phase @auth_token = get_auth_token(request.params["username"], request.params["sid"]) @user_info = get_user_info(@auth_token) super rescue Exception => ex fail!("Failed to retrieve user info from ebay", ex) end def raw_info @user_info end end end end OmniAuth.config.add_camelization 'ebay', 'Ebay'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-ebay-0.0.3 | lib/omniauth/strategies/ebay.rb |