I want to use Oauth to connect to Gmail in Python. Right now I've got the xoauth.py script from Google (link), and generating a token works all fine, but how can I then use that in another script? It's going to be in Django.
Right now my script logs in like this:
m = imaplib.IMAP4_SSL("imap.gmail.com")
m.login("[email protected]", "password")
But I want something more secure.
Here's an example using the
oauth2
module to authenticate using oauth, taken from the readme:Quite a bit cleaner than using
xoauth
.