Google Calendar API v3 - How to obtain a refresh token (Python)

后端 未结 4 882
离开以前
离开以前 2020-12-29 06:51

I am trying to write a Django app which creates events in a specific Google calendar. So far I have been successful. There is only a little problem:

I don\'t

4条回答
  •  太阳男子
    2020-12-29 07:28

    If you follow this manual https://developers.google.com/identity/protocols/OAuth2WebServer and you can not receive refresh_token, try to add prompt='consent' here:

    authorization_url, state = flow.authorization_url(
        # Enable offline access so that you can refresh an access token without
        # re-prompting the user for permission. Recommended for web server apps.
        access_type='offline',
        prompt='consent',
        # Enable incremental authorization. Recommended as a best practice.
        include_granted_scopes='true')
    

    Here is described why it can happen

提交回复
热议问题