Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rails error: unknown auth type - "XOAUTH2" #3

Closed
jrgoodner opened this issue Sep 16, 2012 · 3 comments
Closed

Rails error: unknown auth type - "XOAUTH2" #3

jrgoodner opened this issue Sep 16, 2012 · 3 comments

Comments

@jrgoodner
Copy link

Hi Nicolas, thanks so much for writing this up!

Any idea why I'm getting the following error when I run these commands?

require "net/http"
require "net/imap"
require 'oauth2'
require 'gmail_xoauth'

...

server = 'IMAP.gmail.com'
port = '993'
email = 'XXXXXX@gmail.com'
token = 'XYXYXYXYYXYXYXYYXYXYXYXYYXYXYYXYXYXYYX'
gmail_imap = Net::IMAP.new(server,port,usessl = true, certs = nil, verify = false)
gmail_imap.authenticate('XOAUTH2', email, token)

I'm reasonable certain that the email / token are valid (though I'm not sure how to validate them). Thanks a million for your help!

Best,
Jared

@nfo
Copy link
Owner

nfo commented Sep 16, 2012

Hi Jared, you apparently did not install the last version of gmail_xoauth, which is 0.4.0.

Try a bundle update gmail_xoauth if you use Bundler, or just a gem install gmail_xoauth otherwise.

By the way, you can easily test your tokens thanks to the oauth2.py tool.

python oauth2.py --test_imap_authentication --access_token=yyyyy --user=xxx@gmail.com

Also, I made a typo in the README, it's not gmail_imap.authenticate('XOAUTH2', email, token), but gmail_imap.authenticate('XOAUTH2', email, :token => token). Fixing it.

@nfo
Copy link
Owner

nfo commented Sep 16, 2012

By the way, I'm changing this :token => token stuff. No need to give a Hash when you just need a String. Will be in 0.4.1.

@nfo
Copy link
Owner

nfo commented Sep 16, 2012

0.4.1 released, please check the README

@nfo nfo closed this as completed Apr 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants