I fail to use the non-interactive mode for gmailr package. It works when I first, interactively log into and allow the API however after few non-interactive runs it dies off, requesting new access interactively. Below is the debug flow of information from the tool:
2021-07-01 17:19:28 INFO::Checking for new dates
> trying `token_fetch()`
> trying `credentials_service_account()`
> Error caught by `token_fetch()`:
Argument 'txt' must be a JSON string, URL or file.
> trying `credentials_app_default()`
> trying `credentials_gce()`
> trying `credentials_byo_oauth()`
> Error caught by `token_fetch()`:
inherits(token, "Token2.0") ist nicht TRUE
> trying `credentials_user_oauth2()`
> Gargle2.0 initialize
> adding 'userinfo.email' scope
> loading token from the cache
> The gmailr package is requesting access to your Google account
Select a pre-authorised account or enter '0' to obtain a new token
Press Esc/Ctrl + C to cancel
1: xxx@gmail.com
Auswahl: 1
> matching token found in the cache
Auto-refreshing stale OAuth token.
> Removing token from the cache:
C:/Users/xxx/AppData/Local/gargle/gargle/Cache/9bf775756e404caa38fa87f520d83a56_xxx@gmail.com
Fehler in gmailr_POST(c("messages", "send"), user_id, class = "gmail_message", :
Gmail API error: 401
Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
I cannot figure what should be the correct workflow.
I fail to use the non-interactive mode for gmailr package. It works when I first, interactively log into and allow the API however after few non-interactive runs it dies off, requesting new access interactively. Below is the debug flow of information from the tool:
My debug thread looks like follows:
I cannot figure what should be the correct workflow.
EDIT: 2021-09-21:
The token is valid for exactly a week. then the gmailr or gargle asks me for a new one interactively. What will work permamently?