Ruby China
  • 社区
  • 招聘
  • Wiki
  • 酷站
  • Gems
  • 注册
  • 登录
neilalaer
@neilalaer
高级会员
第 2275 位会员 / 2012-05-22

2 篇帖子 / 7 条回帖
0 关注者
0 正在关注
0 收藏
未设置 GitHub 信息。
  • 概况
  • 话题
  • 回帖
  • 收藏
  • 正在关注
  • 关注者
  • [已解决] 使用 omniauth-weibo-oauth2 的问题 at 2012年05月29日

    见原帖更新部分。

  • [已解决] 使用 omniauth-weibo-oauth2 的问题 at 2012年05月25日

    有点晕,我把本地的访问地址改成http://127.0.0.1:3000, 总算能导航到授权页面了。

    新的问题又出来了,invalid authorization code (error code: 21325),

    Started GET "/users/auth/weibo" for 127.0.0.1 at 2012-05-25 15:06:18 +0800
    (weibo) Request phase initiated.
    
    Started GET "/users/auth/weibo/callback?code=60f9abd48b0300832834d49df8fd3xxx" for 127.0.0.1 at 2012-05-25 15:06:18 +0800
    (weibo) Callback phase initiated.
    (weibo) Callback phase initiated.
    (weibo) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: invalid authorization code:60f9abd48b0300832834d49df8fd3xxx
    {"error":"invalid_grant","error_code":21325,"request":"/oauth2/access_token","error_uri":"/oauth2/access_token","error_description":"invalid authorization code:60f9abd48b0300832834d49df8fd3xxx"}
    Processing by Users::OmniauthCallbacksController#failure as HTML
      Parameters: {"code"=>"60f9abd48b0300832834d49df8fd3xxx"}
    Redirected to http://127.0.0.1:3000/users/sign_in
    Completed 302 Found in 184ms
    
  • [不再处理] 关于 ‘weibo 登陆的相关 gems 和使用方法’ 的问题 at 2012年05月24日

    见原贴头部更新的内容。

  • [不再处理] 关于 ‘weibo 登陆的相关 gems 和使用方法’ 的问题 at 2012年05月22日

    @sharp 你说的对,谢谢指正!

    我之前改 Gemfile,属于 trial-n-error;对于网上看到过的“omniauth_china 已经 move 到 omniauth 里面”也没有提起注意 (我真的不知道什么时候开始,Gemfile 开始成为 best practice 的)。

    Gemfile 可以改为

    gem 'omniauth'
    gem 'oa-oauth' , '>= 0.3.2'
    

    哎呀,那个参数过多的问题又出来了 0_0i

  • [不再处理] 关于 ‘weibo 登陆的相关 gems 和使用方法’ 的问题 at 2012年05月22日

    谢谢提醒!好吧,我再看看。

    我分别参考以下两篇博客进行 rails 配置,还没有写什么功能代码。 http://jimdrannbauer.com/2011/01/29/rails-3-rspec-cucumber-jquery-devise-mongoid-and-compass/ http://www.haojii.com/2011/09/rails-oauth-with-sina-weibo-tutorial/

  • [不再处理] 关于 ‘weibo 登陆的相关 gems 和使用方法’ 的问题 at 2012年05月22日

    我确实配置了申请的 key 和 secret key,此处只是用来替代明文。

    我现在的进度是: 修改 oa-oauth (0.2.6) lib/omniauth/strategies/oauth.rb 大约第 14 行#initilize 方法体中,改super为super(app, options). 避免上面提到 ArgumentError; 现在在处理<%= link_to '微博登陆', '/auth/tsina' %>的问题,参考教程里没有在 route 里配置的,我想是其他机制吧?

    因为从来没有接触过 Rack,现在慢慢开始学。

  • [不再处理] 关于 ‘weibo 登陆的相关 gems 和使用方法’ 的问题 at 2012年05月22日

    补充信息:rails 3.2.3, ruby 1.9.3

关于 / RubyConf / Ruby 镜像 / RubyGems 镜像 / 活跃会员 / 组织 / API / 贡献者
由众多爱好者共同维护的 Ruby 中文社区,本站使用 Homeland 构建,并采用 Docker 部署。
服务器由 赞助 CDN 由 赞助
iOS 客户端 / Android 客户端 简体中文 / English