url = 'https://mail.google.com/mail/b/your_users_email@gmail.com/imap/'
conn = imaplib.IMAP4_SSL('imap.googlemail.com')
conn.debug = 4
conn.authenticate(url, consumer, token)
conn.select('INBOX')
print(conn.list())
use imaplib and oauth for connection with Gmail