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
So if you've already accepted consent without setting access_type='offline'
, you need to force the user to consent to your app with offline access by also passing approval_prompt='force'
.
self.flow = OAuth2WebServerFlow(
client_id=self.client_id,
client_secret=self.client_secret,
scope=self.SCOPE,
user_agent=user_agent,
redirect_uri='urn:ietf:wg:oauth:2.0:oob',
access_type='offline', # This is the default
approval_prompt='force'
)
Then you can remove the force prompt/set it to auto
after you get the refresh token.