Skip to content

Commit

Permalink
set scopes if necessary with gce_auth() (#97)
Browse files Browse the repository at this point in the history
and update to googleAuthR 0.6.0
  • Loading branch information
MarkEdmondson1234 committed Oct 24, 2017
1 parent 4e11e17 commit 91335bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -19,7 +19,7 @@ Depends:
Imports:
assertthat,
future (>= 1.2.0),
googleAuthR (>= 0.5.1),
googleAuthR (>= 0.6.0),
httr (>= 1.3.1),
jsonlite (>= 1.1),
utils
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
@@ -1,6 +1,6 @@
# 0.2.0.9000

* ...
* set scopes if necessary with gce_auth() (#97)

# 0.2.0

Expand Down
8 changes: 8 additions & 0 deletions R/auth.R
Expand Up @@ -25,6 +25,14 @@ gce_auth <- function(new_user = FALSE, no_auto = FALSE){
required_scopes <- c("https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/compute")

op <- getOption("googleAuthR.scopes.selected")
if(is.null(op)){
options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/cloud-platform")
} else if(!any(required_scopes %in% op)){
options(googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/cloud-platform",
op))
}

googleAuthR::gar_auto_auth(required_scopes,
new_user = new_user,
no_auto = no_auto,
Expand Down

0 comments on commit 91335bb

Please sign in to comment.