I am trying to add open-id functionality to my app, I am using omniauth and omniauth-openid gems for same.
I have done the installation steps added it to initializer as middleware,
require 'omniauth-openid'
require 'openid/store/filesystem'
Rails.application.config.middleware.use OmniAuth::Builder do
provider :open_id, :store => OpenID::Store::Filesystem.new('/tmp')
end
and a routes for andling callback
match '/auth/:provider/callback' => 'callback#myauthentication'
when I try to hit this url, to connect to google provider
http://[mydomain]/auth/open_id?openid_url=https%3A%2F%2Fwww.google.com%2Faccounts%2Fo8%2Fid
I get connection failed error everytime
For Yahoo http://[mydomain]/auth/open_id?openid_url=http%3A%2F%2Fme.yahoo.com%2F
Furthur if I try with yahoo open id , even after authenticating correctly I get invalid_credentials error Update 1: I am using apache web server, and thin/webrick app server. I verified that if I am not behind a apache web server and run directly as localhost:3000 it works fine. Why does omniauth behave differently
Try this gem https://github.com/zquestz/omniauth-google-oauth2, I've had good results with it.
来源:https://stackoverflow.com/questions/12908608/connection-failed-for-google-open-id-using-omniauth