Omniauth 与 FourSquare 问题

发布于 2024-11-03 03:16:21 字数 1054 浏览 3 评论 0原文

更新2011/05/01: 后来我仔细阅读了FourSquare的API文档,发现它说:

(请注意,请求参数不是 JSON,它们是标准 HTTP 键和值。)所有身份验证均通过 OAuth2,这意味着所有请求都必须是 https。

这可能是我的开发机器上没有 SSL 连接的问题吗?


大家好!我正在尝试通过 Omniauth 连接 FourSquare,我按照下面的 Railscast toturial 操作,并将提供程序更改为 foursquare。但返回始终是“invalid_credentials”。我用谷歌搜索了一下,发现 GitHub 上有关于这个的讨论(下面的链接),但似乎还没有结论。 任何人都知道出了什么问题吗?

Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, "XXXXXXX","XXXXXXX"
provider :foursquare, 'XXXXXXX',
'XXXXXXX'
end

RailsCast 链接

GitHub 上的讨论

UPDATE 2011/05/01:
I later carefully read through FourSquare's API document, and found it says:

(Note that the request parameters are not JSON, they are standard HTTP keys and values.) All authentication is via OAuth2, which means that all requests MUST be https.

Could this be the problem that I don't have a SSL connection in my development machine?


Hi all! I am trying to connect FourSquare via Omniauth, I followed the Railscast toturial below, and change the provider into foursquare. But the return is always "invalid_credentials". I googled around and find that there's a discussion about this on GitHub(links below), but seems no conclusion yet.
Anyone has idea what went wrong?

Rails.application.config.middleware.use OmniAuth::Builder do
provider :twitter, "XXXXXXX","XXXXXXX"
provider :foursquare, 'XXXXXXX',
'XXXXXXX'
end

RailsCast Link

Discussion on GitHub

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

貪欢 2024-11-10 03:16:21

我有一个可以与 foursquare 的omniauth 一起使用的宝石。

https://github.com/arunagw/omniauth-foursquare

I have a gem which will work with omniauth for foursquare.

https://github.com/arunagw/omniauth-foursquare

虚拟世界 2024-11-10 03:16:21

尝试修改您的提供程序初始值设定项以指向系统的证书路径(Ubuntu 上的“/etc/ssl/certs”)

Rails.application.config.middleware.use OmniAuth::Builder do
    provider :twitter, "XXXXXXX","XXXXXXX"
    provider :foursquare, 'XXXXXXX', {:client_options => {:ssl => {:ca_path => "/etc/ssl/certs"}}}
end

try to modify your provider initializer to point to your system's certificate path ("/etc/ssl/certs" on Ubuntu)

Rails.application.config.middleware.use OmniAuth::Builder do
    provider :twitter, "XXXXXXX","XXXXXXX"
    provider :foursquare, 'XXXXXXX', {:client_options => {:ssl => {:ca_path => "/etc/ssl/certs"}}}
end
蓝色星空 2024-11-10 03:16:21

您的配置看起来不错,尽管您可能不想公开共享您的令牌/密钥。

您在注册 foursquare oauth Consumer 时使用的回调网址是否与您正在测试的网址匹配?如果您使用 http://www.foo.com/auth/foursquare/callback 时注册您的消费者,但正在您的开发环境(http://localhost:3000/..)上进行测试,您将看到身份验证/失败错误。

Your config looks fine, although you probably don't want to share your token/secret keys publicly.

Does the callback url that you used when registering your foursquare oauth consumer match the URL that you're testing with? If you used http://www.foo.com/auth/foursquare/callback when registering your consumer, but are testing on your dev environment (http://localhost:3000/..), you'll see that auth/failure error.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文