omn​​iauth gowalla 策略错误:String 与 Bignum 的比较失败

发布于 2024-12-06 17:10:27 字数 593 浏览 1 评论 0原文

据我所知,gowalla 身份验证代码响应包含 expires_atexpires_in 但 expires_at 不是有效的日期字符串,因此在比较日期时会抛出错误
任何破解omniauth或gowalla策略的想法都将非常受欢迎!

导轨3.0.9 红宝石 1.9.2

comparison of String with Bignum failed
oauth2 (0.5.0) lib/oauth2/access_token.rb:72:in `<'
oauth2 (0.5.0) lib/oauth2/access_token.rb:72:in `expired?'
oa-oauth (0.3.0) lib/omniauth/strategies/oauth2.rb:67:in `callback_phase'


{
"scope":"read",
"expires_at":"Sun, 09 Oct 2011 12:47:37 -0000",
"username":"altuure",
"expires_in":1172767,
"refresh_token":"XX",
"access_token":"XX" 
}

as far as I can get gowalla auth code response contains both expires_at and expires_in but
expires_at is not valid date string so it throws error while comparing dates
any idea to hack omniauth or gowalla strategy would be very welcome!!!

rails 3.0.9
ruby 1.9.2

comparison of String with Bignum failed
oauth2 (0.5.0) lib/oauth2/access_token.rb:72:in `<'
oauth2 (0.5.0) lib/oauth2/access_token.rb:72:in `expired?'
oa-oauth (0.3.0) lib/omniauth/strategies/oauth2.rb:67:in `callback_phase'


{
"scope":"read",
"expires_at":"Sun, 09 Oct 2011 12:47:37 -0000",
"username":"altuure",
"expires_in":1172767,
"refresh_token":"XX",
"access_token":"XX" 
}

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

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

发布评论

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

评论(2

听不够的曲调 2024-12-13 17:10:27

你为什么不尽你所能地使用它呢? expires_in 似乎是一个间隔,所以你可以这样做:

expires_at = Time.now + json["expires_in"].to_i

也就是说,expires_at 的日期字符串肯定在 1.9.2-p290 中解析(使用 DateTime.parse (str))。如果您需要根据给定格式解析日期/时间字符串,则总是有 DateTime.strptime

Why don't you just use whatever you can. expires_in appears to be an interval, so you can do:

expires_at = Time.now + json["expires_in"].to_i

That said, the date string for expires_at definitely parses in 1.9.2-p290 (using DateTime.parse(str)). There's always DateTime.strptime if you need to parse a date/time string according to a given format.

樱娆 2024-12-13 17:10:27

抱歉耽搁了,但我已将补丁提交到 github,您可以在此处找到详细信息 http://github .com/intridea/omniauth/issues/485

sorry for delay but I commited the patch to the github you can find the details over here http://github.com/intridea/omniauth/issues/485

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