I am trying to get the oauth token, which I can use with gmail_xauth (ruby gem) to view the user's mail. First I registered my application with google and then configure the application to request access to mail:
config.omniauth :google, 'key', 'secret', :scope => 'https://mail.google.com/mail/feed/atom/'
Then I look through the outh / openid stream, and google tells me to approve gmail access, redirect me back to the application with a token and secret in my omniuth credentials, and my Google account lists my application as allowed to access my data. So far, so good.
Now when I take these credentials and try to use them with gmail_xoauth I like this:
require 'gmail_xoauth' imap = Net::IMAP.new('imap.gmail.com', 993, usessl = true, certs = nil, verify = false) imap.authenticate('XOAUTH', '...@gmail.com', :consumer_key => 'key, :consumer_secret => 'secret', :token => 'omniauth_returned_token', :token_secret => 'omniauth_returned_secret' )
I get the error "Net :: IMAP :: NoResponseError: invalid credentials (Failure)".
Interestingly, after gmail_xoauth README to create a token with the same consumer using a python script, it works.
ruby oauth gmail devise omniauth
Parker thompson
source share