Connection failed for google open_id using omniaut

2019-05-07 02:47发布

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

1条回答
再贱就再见
2楼-- · 2019-05-07 03:17

Try this gem https://github.com/zquestz/omniauth-google-oauth2, I've had good results with it.

查看更多
登录 后发表回答