How do I connect to Gmail's IMAP server using oauth in Rails3?

无人久伴 提交于 2019-12-05 01:32:00

You may want to check out OmniAuth. It's a gem that encapsulates/abstracts a lot of the underlying protocol work that must be done for OAuth, as well as other authentication/authorization protocols like OpenID and LDAP. I'm not well versed on Google's API for sending/receiving email, but authenticating is the first step.

The OmniAuth wiki has a very good tutorial on using it with OpenID and Google Apps, although this may not be quite what you're looking for when it comes to IMAP. You may need to write your own provider for OmniAuth (a good tutorial describing this is available). Google also provides a reference site for authenticating/authorizing via IMAP and OAuth. The most relevant part of that to you would most likely be the page detailing the protocol.

Hope that helps!

I'm not going to write the full code for you, but do you know PHP? You could have a look at the way this example works:

http://googlecodesamples.com/docs/php/Docs.php

...then make something similar in Ruby.

This is a Google Code Sample from the following site:

http://googlecodesamples.com/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!