GitHub OAuth 使用 Devise + OmniAuth [英] GitHub OAuth using Devise + OmniAuth

查看:33
本文介绍了GitHub OAuth 使用 Devise + OmniAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 http://github.com/rails3book/ticketee 有一个应用程序,其中包含Devise 提供的 OAuth 部分.配置位于 config/initializers/devise.rb.我已经在 Twitter 上进行了这项工作,但总是从 GitHub 收到此无效凭据"消息.

I've got an application at http://github.com/rails3book/ticketee that contains an OAuth portion provided by Devise. The configuration is at config/initializers/devise.rb. I have got this working with Twitter but always get this "invalid credentials" message back from GitHub.

我看不出我在 Twitter 和 GitHub 之间做的有什么不同.据我所知,这应该可以正常工作(tm).

I cannot see what I am doing differently between Twitter and GitHub. To my knowledge, this should Just Work(tm).

推荐答案

这实际上是因为 GitHub 的 OAuth2 支持不符合 OAuth2 规范的当前草案.基本上,他们想要一个名为access_token"的参数,但 oauth2 gem 的最新版本(撰写本文时为 0.3.0)将其作为oauth_token"传递,这是草案的最新版本所要求的.

This is actually because GitHub's OAuth2 support doesn't mesh with the current draft of the OAuth2 specification. Basically, they want a parameter called "access_token" but the oauth2 gem's latest version (0.3.0 as of this writing) passes this through as "oauth_token", as the latest version of the draft requires.

这基本上适用于除 GitHub 之外的所有其他提供商,因为他们尚未更新对这个替代命名参数的支持.

This basically works with every other provider except GitHub because they haven't yet updated their support for this alternatively named parameter.

这篇关于GitHub OAuth 使用 Devise + OmniAuth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆