Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error message if credentials_service_account() pointing at incorrect file #93

Closed
MarkEdmondson1234 opened this issue Jul 7, 2019 · 0 comments

Comments

@MarkEdmondson1234
Copy link
Contributor

One of the most common errors I've seen when authenticating with service accounts is that user's try to use the client JSON rather than the service account key JSON.

If I replicate this behaviour with credentials_service_account() I get an error that the file is not present, rather than it is present but the wrong file.

path <- "../../auth/client.json"
credentials_service_account(scopes = "email", path = path)
Error in read_input(file) : 
  file must be connection, raw vector or file path
> file.exists(path)
# TRUE

To help with this I check for the presence for $private_key in the JSON file, to help give a hint:

  secrets  <- fromJSON(json_file)
  
  if(is.null(secrets$private_key)){
    stop("$private_key not found in JSON - have you downloaded the correct JSON file? 
         (Service Account Keys, not service account client)")
  }
@jennybc jennybc added this to the v0.4.0 milestone Oct 2, 2019
@jennybc jennybc closed this as completed in 39b9c8c Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants