Connection failed for google open_id using omniauth

为君一笑 提交于 2019-12-12 09:44:16

问题


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:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!