Access Gmail Imap with OAuth 2.0 Access token

后端 未结 4 2050
忘掉有多难
忘掉有多难 2021-02-02 00:52

I am using Google\'s Oauth 2.0 to get the user\'s access_token, but I dont know how to use it with imaplib to access inbox.

4条回答
  •  隐瞒了意图╮
    2021-02-02 01:40

    This is something I've been kicking around. I didn't want to juggle refreshing access tokens and what not myself -- I also found there was too much boilerplate code in the Google example. I decided just to write very simple wrappers that allow for OAuth2 IMAP and SMTP that utilize Credentials and Flow objects from google-api-python-client.

    Hopefully this helps somebody.

    https://github.com/richieforeman/oauth2gmail

提交回复
热议问题