Closed danieltreacy closed 8 years ago
Lovely. Thanks :+1:
Hey, this is pretty awesome! @owainlewis, do you suppose you could cut a release with this, please?
@danieltreacy I just gave this a try, but I'm having trouble authenticating. What is the oauth-token
supposed to be? I have a client ID, client secret, and refresh token. Am I supposed to join those together in some way?
So, I started reading this: https://developers.google.com/gmail/xoauth2_protocol?hl=en
I think the problem is that I don't have the https://mail.google.com/
scope.
@cstrahan You get an Oauth token from an application that is registered to authenticate users against the Gmail API. If you don't have your own application, you can generate a personal test token using the Google OAuth Playground (https://developers.google.com/oauthplayground/)
Make sure you select the right scopes (just select all of the URLs in the "Gmail API v1" dropdown, otherwise the authentication will fail.
The token to pass to xoauth-store
is the access token generated in step 2, not the refresh token or authorization code.
@cstrahan Didn't see your second post - yes, the missing scope would lead to an authentication failure :)
@danieltreacy Awesome, thanks! I'm not terribly familiar with OAuth, so I didn't grok the distinction until now. I read through how gmail-clj gets an access token, and used that to successfully create a store.
Thanks a ton!
@cstrahan Just pushed 1.0.4 release. Let me know if you have any issues. Thanks :+1:
This change adds a
xoauth2-store
helper function that allows a user to authenticate using an email address and an Oauth access token.It also adds a Gmail-specific helper in the
clojure-mail/gmail
namespace that sets the Gmail IMAP server and protocol defaults.The README has been updated with an example of usage.