我正在尝试在一个使用谷歌作为登录提供商的sinatra应用程序中使用OmniAuth。使用Twitter和Facebook提供商工作正常:
require 'omniauth'
require 'openid'
require 'openid/store/filesystem'
use OmniAuth::Builder do
use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('./tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
end
get '/sign_in'
redirect '/auth/google'
end
思考?当浏览器尝试获取'/ auth / google'时,它会获得503 - 服务不可用。 heroku日志中没有任何内容
关于这可能是什么的想法或建议?
我刚开始对这个问题表示赏心悦目 - 我希望的是一个适用于heroku的示例实现。
我增加了heroku的日志级别。这是我现在得到的:
2011-07-07T16:15:09+00:00 heroku[nginx]: GET /sign_in/?p=google HTTP/1.1 | 207.224.213.179 | 269 | http | 302
2011-07-07T16:15:09+00:00 app[web.1]: I, [2011-07-07T09:15:09.863397 #1] INFO -- OpenID: Error attempting to use stored discovery information: OpenID::TypeURIMismatch
2011-07-07T16:15:09+00:00 app[web.1]: I, [2011-07-07T09:15:09.863480 #1] INFO -- OpenID: Attempting discovery to verify endpoint
2011-07-07T16:15:09+00:00 app[web.1]: I, [2011-07-07T09:15:09.863512 #1] INFO -- OpenID: Performing discovery on https://www.google.com/accounts/o8/id?id=AItOawlAKE9QAQb9mMRyYCCmAkEYIcqfmhrA080
2011-07-07T16:15:09+00:00 app[web.1]: I, [2011-07-07T09:15:09.865033 #1] INFO -- OpenID: WARNING: making https request to https://www.google.com/accounts/o8/id?id=AItOawlAKE9QAQb9mMRyYCCmAkEYIcqfmhrA080 without verifying server certificate; no CA path was specified.
2011-07-07T16:15:09+00:00 app[web.1]: 207.224.213.179 - - [07/Jul/2011 09:15:09] "POST /auth/google/callback HTTP/1.1" 302 - 0.0956
2011-07-07T16:15:09+00:00 heroku[router]: GET myurl.com/auth/google/callback dyno=web.1 queue=0 wait=0ms service=100ms status=302 bytes=0
答案 0 :(得分:0)
您可以使用google的openid登录。
use OmniAuth::Builder do
provider :openid, OpenID::Store::Filesystem.new('/tmp')
use OmniAuth::Strategies::OpenID, OpenID::Store::Filesystem.new('/tmp'), :name => 'google', :identifier => 'https://www.google.com/accounts/o8/id'
end
答案 1 :(得分:0)
https://github.com/intridea/omniauth/wiki/OpenID-and-Google-Apps处的页面提供了两种可能的解决方案:
在Heroku上,您可以将路径更改为“./tmp”或使用Memcached。
您好像已经尝试过Memcached解决方案 - 您是否在Heroku上运行并正确设置了Memcached实例?