Hope you are fine. I have tried everything and I have no idea why doesnt work anymore. I used to run a script in r in a virtual machine that alerted me the status of the script. Stopped working around October last year
Tried a work around Why is gmailr not working in docker build process?
worked twice and again getting the same error
code:
library(gmailr)
library(tidyr)
library(gargle)
send_email_on_error <- function(send = "[email protected]"
,to="[email protected]"
,subject
,body) {
cred_funs_clear()
cred_funs_add(credentials_user_oauth2 = credentials_user_oauth2)
gm_auth_configure(path="path\\GmailKey.json")
# options(
# gargle_oauth_cache = "secret",
# gargle_oauth_email = "[email protected]"
# )
gm_auth(email = "[email protected]"
)
cred_funs_set_default()
# send<-"[email protected]"
# to<-"[email protected]"
# Send an email
email<- gm_mime() %>%
gm_to(to) %>%
gm_from(send) %>%
gm_subject(subject) %>%
gm_text_body(body)
gm_send_message(email)
}
send_email_on_error(subject="test from vm",body= "test from vm")
print("done")
Do you have any idea what am I doing wrong I
Error
trying `token_fetch()`
trying `credentials_user_oauth2()`
Gargle2.0 initialize
adding "userinfo.email" scope
Error caught by `token_fetch()`:
error reading from connection
Error in `gm_auth()`:
! Can't get Google credentials.
of course credentials are good, any idea?
Using Windows Azure VM