Re: KeyError: 'refresh_token' error in fetchmail-oauth2

"J.Edner" <[email protected]> Sun, 24 Apr 2022 11:38:50 +0200
Newsgroups gmane.mail.fetchmail.user
Organization private
Message-ID <[email protected]>
Hello Marco,

>> Juergen Edner say that the OAuth client created in 'Test mode' least at
>> maximum a week.
>> But if i try to publish the app, i need the Google approval process, because
>> the api used (eg, GMAIL API) is 'restricted'.
>> So, it is needed to publish the app? If yes, what is the shortest and error
>> prone path to get it approved?
> 
> OK, i can confirm Juergen is true; after 7 days:
> 
>   /home/famiglia/fetchmail-oauth2.py -c /home/famiglia/.oauth2.conf --auto_refresh
>   Traceback (most recent call last):
>     File "/home/famiglia/fetchmail-oauth2.py", line 591, in <module>
>       main(sys.argv)
>     File "/home/famiglia/fetchmail-oauth2.py", line 502, in main
>       newTok = response['access_token']
>   KeyError: 'access_token'
> 
> I've redone the auth with '--obtain_refresh_token_file' and now works back
> as usual.
> 
> 
> I perfectly agree that big G is not fair on this, but... more practically,
> how can i 'register' a (fake?) fetcmail app?

In general there is not always a requirement to get your application
verified by Google, if you set the status to "external" and 
"production". This was one of the most irritating facts for me too,
as I configured Fetchmail OAuth2 access for the first time. These are
the verification rules:

   Verification Status
   -------------------
   Google verifies projects configured for a user type of External and
   a publishing status of In production if they meet one or more of the
   OAuth verification criteria:

   * You want to display an icon or display name for your project on the
     OAuth consent screen.
   * Your project's OAuth clients request authorization of any sensitive
     or restricted scopes.
   * The number of authorized domains for your project exceeds the domain
     count limit.
   * There are changes to your project's OAuth consent screen
     configuration after a previous published, verified configuration.

Regards
Juergen