我试图获得一个oauth令牌,我可以使用它与gmail_xauth(ruby gem) 来查看用户的邮件。我第一次注册我与谷歌的应用程序和 然后设置色器件请求访问邮箱:针对Gmail的omniauth oauth令牌无效
config.omniauth :google, 'key', 'secret', :scope => 'https://mail.google.com/mail/feed/atom/'
然后我经过OUTH/OpenID的流量和谷歌提示我 批准访问Gmail,重定向我回该应用程序与一个令牌 和秘密omniuth凭据&我的Google帐户列出我的应用程序 被授权访问我的数据。到现在为止还挺好。
现在,当我把这些凭据,并尝试以 gmail_xoauth使用它们像这样:
require 'gmail_xoauth'
imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs =
nil, verify = false)
imap.authenticate('XOAUTH', '[email protected]',
:consumer_key => 'key,
:consumer_secret => 'secret',
:token => 'omniauth_returned_token',
:token_secret => 'omniauth_returned_secret'
)
我得到一个错误 “的Net :: IMAP :: NoResponseError:无效的凭证 (失败)”。
有趣的是,使用gmail_xoauth README生成一个令牌 与使用python脚本的消费者使用同一个工具。
你有解决这个问题的方法吗? – Pablo 2011-05-16 05:51:08
同样在这里。你找到解决方案吗? – Pasta 2011-05-16 14:01:45
我有类似的问题,但找到了解决方案。请参阅下面的答案。 – Andrew 2012-10-24 20:05:35