From 64ba392c8e04842dce317a6ba78e8329e63d9260 Mon Sep 17 00:00:00 2001 From: Ali Ebrahim Date: Tue, 24 Jan 2023 11:26:33 -0800 Subject: [PATCH] Fix authorized_user ADC without explicit scopes. Fix a bug where if no scopes are passed in, application default credentials fail in the authorized_user flow. ``` >>> credentials_app_default() NULL >>> credentials_app_default(scopes=c("https://www.googleapis.com/auth/cloud-platform")) ``` --- R/credentials_app_default.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/credentials_app_default.R b/R/credentials_app_default.R index 978407f6..805b5d27 100644 --- a/R/credentials_app_default.R +++ b/R/credentials_app_default.R @@ -67,7 +67,7 @@ credentials_app_default <- function(scopes = NULL, ..., subject = NULL) { "https://www.googleapis.com/auth/cloud-platform", "https://www.googleapis.com/auth/cloud-platform.readonly" ) - if (is.null(scopes) || !all(scopes %in% valid_scopes)) { + if (!is.null(scopes) && !all(scopes %in% valid_scopes)) { return(NULL) } gargle_debug("ADC cred type: {.val authorized_user}")