Ruby open_id_authentication with Google OpenID

前端 未结 3 1878
小鲜肉
小鲜肉 2021-01-07 10:35

I am in my first steps of implementing OpenID in my Rails app. open_id_authentication appeared to be a fairly easy-to-use plugin, which is why I decided to use it.

L

相关标签:
3条回答
  • 2021-01-07 10:57

    this post contains a good strategy to use AX for google and Sreg for others, to make this happen a little more seamlessly http://www.franzens.org/2009/01/using-google-federated-login-in-your.html

    0 讨论(0)
  • 2021-01-07 10:59

    I've also stitched together a complete solution to Ruby on Rails 3, OpenID, and Google: http://blog.sethladd.com/2010/09/ruby-rails-openid-and-google.html

    0 讨论(0)
  • 2021-01-07 11:08

    The authenticate_with_open_id return the Sreg object, not the AX response. So you need instanciate this respone with Rack::OpenID::REPONSE like that :

    ax_response = OpenID::AX::FetchResponse.from_success_response(request.env[Rack::OpenID::RESPONSE])
    

    After you can fetch your data

    ax_response['http://axschema.org/contact/email']
    ax_response['http://axschema.org/namePerson/first']
    ax_response['http://axschema.org/namePerson/last']
    
    0 讨论(0)
提交回复
热议问题