2012-10-28 5 views
0

我試圖使用Rack + omniauth在eBay上進行身份驗證(實際上是 - omniauth-ebay)。我有一個正確配置(而不是 「111」, 「222」 ......有實值):如何調試Omniauth和Rack應用程序?

#config.rb 
use OmniAuth::Builder do 
    provider :ebay, "111", "222", "333", "4444", "0", "https://api.sandbox.ebay.com/wsapi" 
end 

當我去到L ocalhost:9292/auth/ebay,我收到的錯誤:

NoMethodError at /auth/ebay 
    undefined method `[]' for nil:NilClass 
    file: ebay_api.rb location: generate_session_id line: 21 

#.... 
omniauth.error - <NoMethodError: undefined method `[]' for nil:NilClass> 
omniauth.error.strategy - #<OmniAuth::Strategies::Ebay> 
omniauth.error.type - "Failed to retrieve session id from ebay" 
omniauth.strategy - <OmniAuth::Strategies::Ebay> 

我想知道的是如何調試?特別是localhost:9292/auth/ebay的路徑,因爲我沒有在我的應用程序中定義它,因爲Omniauth 會自動嵌入

您的想法?

回答

1

Omniauth ebay使用eBay API的純XML版本,而不是SOAP版本。你最後的配置值應

https://api.sandbox.ebay.com/ws/api.dll 

https://api.sandbox.ebay.com/wsapi 

作爲一個側面說明,根據你的錯誤,ebay_api.rb,你似乎有安裝omniauth - 易趣寶石的早期版本。在latest version,有更多的錯誤檢查,應該給你更多的細節。

+0

沒錯,網址現在是正確的。但我使用最新版本,我只是安裝它。 –

+0

但現在它將我重定向到https://signin.ebay.com/ws/eBayISAPI.dll的生產登錄網址。如何讓它使用沙箱網址 - https://signin.sandbox.ebay.com/ws/eBayISAPI.dll? –

+0

不幸的是,這個值在[ebay_api.rb](https://github.com/TheGiftsProject/omniauth-ebay/blob/master/lib/ebay_api.rb)中被硬編碼。您可以在本地更改此設置'EBAY_LOGIN_URL' – 2012-10-28 18:18:13