I'm trying to use OmniAuth in a sinatra app with google as the login provider. Using the twitter and facebook providers work fine:
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
Thoughts? When the browser tries to get '/auth/google', it gets a 503 - Service Unavailable. There is nothing in the heroku logs
Thoughts or suggestions on what this might be?
I just started a bounty on this question - what I'm hoping for is a sample implementation that works on heroku.
I increased the log level on heroku. Here is what I'm getting now:
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 stor开发者_运维技巧ed 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
The page at https://github.com/intridea/omniauth/wiki/OpenID-and-Google-Apps gives two possible solutions:
On Heroku you can change the path to "./tmp" or use Memcached.
It seems like you already tried the Memcached solution - do you have a Memcached instance running and properly setup on Heroku?
You could use google's openid to sign in.
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
精彩评论