我很糟糕。我正在探索Podio API,并一直试图与the sample Podio Rails app一起学习如何运作,但我遇到了一些问题。 (主要问题在底部。)起初我有一个SSL错误:
Started POST "/sessions/createfromappauth" for 127.0.0.1 at 2015-08-14 09:37:38 -0700
Connecting to database specified by database.yml
Processing by SessionsController#createfromappauth as HTML
Parameters: {"utf8"=>"✓", "authenticitytoken"=>"xxxxx=", "appid"=>"xxxxx", "app_token"=>"xxxxxx", "commit"=>"Authenticate as app"}
Completed 500 Internal Server Error in 660ms
OpenSSL::SSL::SSLError (SSLconnect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
app/controllers/sessionscontroller.rb:23:in `createfromapp_auth'
我尝试在Mac上更新我的SSL证书,然后更新Rails应用程序中的所有gem,但都没有工作。最后,我将其修改为putting the cacert.pem file in my /lib directory。
不幸的是现在我收到了错误:
Started POST "/sessions/create_from_app_auth" for 127.0.0.1 at 2015-08-17 10:39:38 -0700
Processing by SessionsController#create_from_app_auth as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxx", "app_id"=>"xxxx", "app_token"=>"xxxx", "commit"=>"Authenticate as app"}
Completed 500 Internal Server Error in 273ms
TypeError (no implicit conversion of Pathname into String):
app/controllers/sessions_controller.rb:23:in `create_from_app_auth'
我正在使用带
的Mac这是来自sessions_controller的代码导致了有问题的错误:
def create_from_app_auth
Podio.setup(
:api_url => 'https://api.podio.com',
:api_key => ENV['PODIO_CLIENT_ID'],
:api_secret => ENV['PODIO_CLIENT_SECRET']
)
Podio.client.authenticate_with_app(params[:app_id], params[:app_token])
session[:podio_access_token] = Podio.client.oauth_token.access_token
session[:podio_refresh_token] = Podio.client.oauth_token.refresh_token
redirect_to root_url, :notice => "Signed in!"
end
有关如何修复TypeError或SSLError的任何想法,所以我没有得到TypeError?提前谢谢!
答案 0 :(得分:0)
行似乎有问题:
Podio.client.authenticate_with_app(params[:app_id], params[:app_token])
请从此行验证参数。你可以打印出来以确保params[:app_id]
和params[:app_token]
都有效而且没有Pathname
吗?