Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

drive_auth() function not creating gargle-oauth token on password submission

$
0
0

R v3.6.2

RStudio Desktop v1.2.5033

R package 'googledrive' v1.0.0

I have written an R script that uploads csv files to a googlesheets account. In order to avoid having to automate this, I have used the drive_auth() function to refresh the OAuth token. Code is simply:

drive_auth(
 email = "email@gmail.com",
 path = NULL,
 scopes = "https://www.googleapis.com/auth/drive",
 cache = gargle::gargle_oauth_cache(),
 use_oob = gargle::gargle_oob_default(),
 token = NULL
)

drive_upload(file, overwrite=TRUE, type="spreadsheet")

On both a mac and a Windows OS machine, this then opens a default browser that asks for login details. When these are correctly entered, the script now has permissions to upload / edit files and googledrive functions subsequently work. It creates an authority token in the file path:

Home/Users/.R/garle/gargle-oauth

However, when attempting to do this on a new laptop that will be used as a server, I am met with the following error messages:

Error: can't get Google credentials.
Are you running googlesheets in a non-interactive session? Consider:
* sheets_deauth() to prevent the attempt to get credentials.
* call 'sheets_auth()' directly with all necessary specifics.

On inspection of the gargle-oauth folder, it has not created an OAuth token, as it did automatically with other machines on the entering of google login details.

I re-ran the programme on the other windows machine after deleting the OAuth token and it worked fine, creating the token again from scratch. I cannot pinpoint the reason why this token is not being created in this instance.


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>