Skip to content

Commit

Permalink
version 1.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Edmondson authored and cran-robot committed Dec 5, 2020
1 parent fa06e5e commit 1dba9ce
Show file tree
Hide file tree
Showing 28 changed files with 1,026 additions and 1,137 deletions.
8 changes: 4 additions & 4 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: googleAuthR
Type: Package
Version: 1.3.0
Version: 1.3.1
Title: Authenticate and Create Google APIs
Description: Create R functions that interact with OAuth2 Google APIs
<https://developers.google.com/apis-explorer/> easily,
Expand All @@ -13,7 +13,7 @@ Authors@R: c(person("Mark", "Edmondson",email = "m@sunholo.com",
person("Neal", "Richardson", email="neal.p.richardson@gmail.com", role = "ctb"),
person("David","Kulp", email="dkulp@cs.umass.edu", role = "ctb"),
person("Joe","Cheng", email = "joe@rstudio.com", role = "ctb"))
URL: http://code.markedmondson.me/googleAuthR/
URL: https://code.markedmondson.me/googleAuthR/
BugReports: https://github.com/MarkEdmondson1234/googleAuthR/issues
Depends: R (>= 3.3.0)
Imports: assertthat (>= 0.2.0), cli (>= 2.0.2), digest, gargle (>=
Expand All @@ -28,7 +28,7 @@ LazyData: true
VignetteBuilder: knitr
RoxygenNote: 7.1.0
NeedsCompilation: no
Packaged: 2020-06-15 18:20:34 UTC; mark
Packaged: 2020-12-05 21:40:54 UTC; mark
Author: Mark Edmondson [aut, cre] (<https://orcid.org/0000-0002-8434-3881>),
Jennifer Bryan [ctb],
Johann deBoer [ctb],
Expand All @@ -37,4 +37,4 @@ Author: Mark Edmondson [aut, cre] (<https://orcid.org/0000-0002-8434-3881>),
Joe Cheng [ctb]
Maintainer: Mark Edmondson <m@sunholo.com>
Repository: CRAN
Date/Publication: 2020-06-16 00:10:05 UTC
Date/Publication: 2020-12-05 22:00:03 UTC
54 changes: 27 additions & 27 deletions MD5
@@ -1,49 +1,49 @@
0fe1cf2491b54822b59fc1cf5bc072e6 *DESCRIPTION
03e68b08ebdba6d276831429d39decfd *DESCRIPTION
28bd6318a320b06c793dd1288a760bc5 *LICENSE
f23827d4274e1ea1aa63b5662330d018 *NAMESPACE
cc6f04771dfc15a137c788271b4b1b2c *NEWS.md
6d3bf123e807db1baf7a6d96d2eecd2d *R/auth.R
f50a936887009f1cf184eeee20815b50 *R/auth_gargle.R
ca5006b63c3405153afeb0f29e155e4e *NEWS.md
186651c5123690d706cf55282f2e8198 *R/auth.R
2528fc1012892cdddf6308f4570b4b08 *R/auth_gargle.R
0e0b5f072d3c78b15a9f2f22bfd63ee0 *R/auth_legacy.R
8899b309a557ce1bc5b346080f301520 *R/auto_auth.R
513fcb2187f361dcc820c73b8210ece3 *R/batch.R
c53c999253a995c305aa19bc3983143d *R/checks.R
c5f715bf2ff270a98e65b2fff6001b64 *R/debugging.R
130cc4de04f989e4053829c8e96934c9 *R/discovery.R
48f46faa47a4ea69f60a35477225003e *R/discovery.R
47d3e06d6dbe06e2525c8e016a1de360 *R/discovery_build.R
d3a1c7c92e26bd965f943a913b55677d *R/discovery_utilities.R
2b8fab39b6d305cf7040cc55e6cb3bd5 *R/gadget.R
9f30cacd6d7c1c6d1534701debaadf2e *R/gce.R
9b51feaeaa7522a860d48aa7c18c6499 *R/generator.R
c8e880bcbb8481de8df859434542528e *R/googleAuthR.R
67bb1480bf60cfc8f8dd4297011a9b4b *R/googleAuthR.R
92791bd9b7bf02096023bffeb194e328 *R/memoise.R
436705bf6aaeb71dec5797562b542aa1 *R/options.R
1509e16943f371936dfdcdbcb8b0b1ef *R/options.R
2ea9fc7feab2ce6f136f7e799de8fd99 *R/page_results.R
c2d8223249f18af6a308124881116684 *R/scopes.R
8bb0a6c7436ee7999cc60c693e7b8823 *R/service_creation.R
676f67c0511cbf70da6ef400acf43a1a *R/set_client.R
60751b456883c368e62b69f106e72472 *R/service_creation.R
d6a3bb20f8d8d6d1d62e073b41b2cc02 *R/set_client.R
c1b2ebead111ecddc5bd3f9979f58aef *R/setup_wizard.R
1984b1c249b2773aeab519fcd2fb9b2f *R/setup_wizard_auth.R
bd9fc50abca8114256a50c98cbecbc8f *R/shiny-auth.R
030b66b8909d12b743d5bc77628e1359 *R/shiny-js-auth.R
2b5498f2ffb93cef1c3f6949d4d87e46 *R/shiny-js-signin.R
a60732cf2cfc6692a90353ed60ae6d33 *R/shiny-modifyurl.R
493f56f14dfebc1bb5a84a581035067b *R/shiny-modifyurl.R
3d48f5aaa98345d1be9cfe03dff1ad28 *R/shiny.R
5840bed076148953b7c4ae41212c9d4b *R/test-helpers.R
3271987cca4198d0a1116c9dcc073cf0 *R/utility.R
573926b0eb9d8369ddc949efbfa5f97f *README.md
8c485937b24c6546e789cbd6f57f5620 *README.md
533d125f8eae5b0690941ee827be1d75 *build/vignette.rds
ef476c247c435987f52f5859d17e95b7 *inst/css/button.css
04cf39af326fd96857869296636dff20 *inst/doc/advanced-building.Rmd
468b800c6a38a10a8820a3a159310156 *inst/doc/advanced-building.html
4748ecd3c454428a5bccc81d47c5d831 *inst/doc/advanced-building.Rmd
6289504bbfa50f7e1c6ef9d6528ddc27 *inst/doc/advanced-building.html
7d2bf9a070a424e8c600743ac60e6bc1 *inst/doc/building.Rmd
a4c2cc398dd398ea6b26da699feb846b *inst/doc/building.html
892fbfede6886008136d1a3e01ff648f *inst/doc/google-authentication-types.Rmd
e684087edae2061025685d92b34c788c *inst/doc/google-authentication-types.html
b989cc3421af86abc305736653cadea7 *inst/doc/setup.Rmd
9e460f83d1bae502b349c04cd79fa01a *inst/doc/setup.html
546c197076a6362303815f507ea83332 *inst/doc/building.html
04c1b2441d4fea7e8a91548f385892dd *inst/doc/google-authentication-types.Rmd
c61e76009eb2821c09d7b8afdebf8eb5 *inst/doc/google-authentication-types.html
c82ec4beb7ec49e7212ec285fdcf5370 *inst/doc/setup.Rmd
4c0546e7d8912a6967166c5750fc6331 *inst/doc/setup.html
f375b3fc5f4a9da22f121474b10bf837 *inst/doc/troubleshooting.Rmd
377b302b5b15c6a8261b87a374a85dd0 *inst/doc/troubleshooting.html
320d7c0722da8e5701f0231b6017a628 *inst/doc/troubleshooting.html
a3f9b806f1ed4baf006d50611078b575 *inst/googledrive_shiny_demo/listGoogleDrive/app.R
477376d302911be898d715e94ca58a88 *inst/img/google_logo.png
cf8bfce980636f2aced78d8e6cddc1ae *inst/js/js-auth.js
Expand Down Expand Up @@ -78,15 +78,15 @@ dd844a377223e9f46910e212bd2fe6b8 *man/gar_check_existing_token.Rd
2df7cb90628dc32188fc0aa943578113 *man/gar_create_package.Rd
5820c5422d753fedbb0426d4efd108f1 *man/gar_deauth.Rd
5f383ad8c8380f08507790c6e5242fe9 *man/gar_debug_parsing.Rd
9ebdc536ff2453b501214783b74076a0 *man/gar_discovery_api.Rd
80fc1aef34b0534a5cb392527c537390 *man/gar_discovery_api.Rd
72a0074537b259ecf4add319b8bf7964 *man/gar_discovery_apis_list.Rd
95d37c6a5050b89f944ac782a51a8ba2 *man/gar_gce_auth.Rd
d258d08a023ce96b79b343daaada58ce *man/gar_gce_auth_default.Rd
9cf44d160d7bfd74b1703d3acf8d1465 *man/gar_gce_auth_email.Rd
cc41b65e929ceb427af5ae3b1b86aafd *man/gar_has_token.Rd
5b366ae6dbc1a30558b852c2fc9c81d7 *man/gar_scope_config.Rd
dafb8266df7e119af1c6742417b4f911 *man/gar_service_create.Rd
06675dbb1ed7d7cc7d9a3661e504cd3a *man/gar_service_provision.Rd
c55250168184a476363d832ee2caab42 *man/gar_service_create.Rd
eb4c6b12a48fb3468a6ded055efc7dc6 *man/gar_service_provision.Rd
22bf3b5b38e348d1dfd97085d09691b2 *man/gar_set_client.Rd
b9fcd004eb43b2103fcf1f324625dc12 *man/gar_setup_auth_check.Rd
cc248f413479de84b101d4185ab86326 *man/gar_setup_auth_key.Rd
Expand All @@ -99,12 +99,12 @@ e4393841428564c05f5ceadc53799e2e *man/gar_setup_get_authenv.Rd
46dbf704da74f9ae49fe3339b213deeb *man/gar_shiny_auth.Rd
30ccebd9113944f7ec2e7305931a614d *man/gar_shiny_auth_url.Rd
40fa00ff18aea0a221fdf6106d131dd6 *man/gar_shiny_login_ui.Rd
9437a6e728d79163ee9f84cf0dbae68b *man/gar_shiny_ui.Rd
c11a33e9a584db6d0364265abfc8e82e *man/gar_shiny_ui.Rd
9adc8475337c6744cc8d81606cd38450 *man/gar_token.Rd
b8165b22a43ac88b82b89721de80a5c9 *man/gar_token_info.Rd
fa6ed013f0c69c8d9dad3aab92a1f114 *man/get_google_token.Rd
43886d360fcf78d1077ecef7c3d3e7ac *man/googleAuth.Rd
e84715b901c6df3f04e1be3e6678f9ec *man/googleAuthR.Rd
da6bd85df71ccdb451f35d72dea221bc *man/googleAuthR.Rd
f658701c0fb6eb3fff94a1b75d9a697e *man/googleAuthUI.Rd
fd23c41ea81c7c986c6acdf4325e46ed *man/googleAuth_js.Rd
21f2658b684c4b7787cc549afd5e9ea1 *man/googleAuth_jsUI.Rd
Expand All @@ -115,8 +115,8 @@ ced615833e75dfef29f3f4ebd6c82e80 *man/silent_auth.Rd
c659165619e07515dc629f7a03f9e22e *man/skip_if_no_env_auth.Rd
c6c8c7e14db01b1f0f656dfccda90e2d *man/token_exists.Rd
e7a84853084c59a8723a9b7f85d652e7 *man/with_shiny.Rd
04cf39af326fd96857869296636dff20 *vignettes/advanced-building.Rmd
4748ecd3c454428a5bccc81d47c5d831 *vignettes/advanced-building.Rmd
7d2bf9a070a424e8c600743ac60e6bc1 *vignettes/building.Rmd
892fbfede6886008136d1a3e01ff648f *vignettes/google-authentication-types.Rmd
b989cc3421af86abc305736653cadea7 *vignettes/setup.Rmd
04c1b2441d4fea7e8a91548f385892dd *vignettes/google-authentication-types.Rmd
c82ec4beb7ec49e7212ec285fdcf5370 *vignettes/setup.Rmd
f375b3fc5f4a9da22f121474b10bf837 *vignettes/troubleshooting.Rmd
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,3 +1,8 @@
# googleAuthR 1.3.1

* Fix `gar_set_client()` returning web-project id if expecting project id and both env arguments are set.
* Fix `gar_service_provision()` and `gar_service_get()` as API error message changed (#197)

# googleAuthR 1.3.0

* Let you supply your own URL for discovery documents in `gar_discovery_api()`
Expand Down
2 changes: 1 addition & 1 deletion R/auth.R
Expand Up @@ -60,7 +60,7 @@ gar_auth <- function(token = NULL,
}

# set scopes to options for backward compatibility
if(!is.null(scopes) && scopes != ""){
if(!is.null(scopes) && any(scopes != "")){
options(googleAuthR.scopes.selected = scopes)
}

Expand Down
10 changes: 2 additions & 8 deletions R/auth_gargle.R
Expand Up @@ -3,15 +3,9 @@

#' Environment to store authentication credentials
#'
#' Used to keep persistent state.
#' Used to keep persistent state. Initialized in .onLoad.
#' @noRd
.auth <- gargle::init_AuthState(
package = "googleAuthR",
auth_active = TRUE
#app = NULL,
#api_key = NULL,
#cred = NULL
)
.auth <- NULL


## The roxygen comments for these functions are mostly generated from data
Expand Down
2 changes: 1 addition & 1 deletion R/discovery.R
Expand Up @@ -124,7 +124,7 @@ gar_discovery_apis_list <- function(){
#' @param version The API version to fetch
#' @param a_url Supply your own discovery URL, for private APIs only
#'
#' @seealso \url{https://developers.google.com/discovery/v1/reference/apis/getRest}
#' @seealso \url{https://developers.google.com/discovery/v1/getting_started}
#'
#' @return Details of the API
#' @family Google Discovery API functions
Expand Down
2 changes: 1 addition & 1 deletion R/googleAuthR.R
@@ -1,6 +1,6 @@
#' googleAuthR: Easy Authentication with Google OAuth2 APIs
#'
#' Get more details on the \href{http://code.markedmondson.me/googleAuthR/}{googleAuthR website}.
#' Get more details on the \href{https://code.markedmondson.me/googleAuthR/}{googleAuthR website}.
#'
#' @section Default options:
#'
Expand Down
8 changes: 8 additions & 0 deletions R/options.R
@@ -1,5 +1,13 @@
.onLoad <- function(libname, pkgname) {

.auth <<- gargle::init_AuthState(
package = "googleAuthR",
auth_active = TRUE
#app = NULL,
#api_key = NULL,
#cred = NULL
)

sys_or_null <- function(x){
sys <- Sys.getenv(x)
if (sys == "") return(NULL)
Expand Down
14 changes: 10 additions & 4 deletions R/service_creation.R
Expand Up @@ -15,8 +15,8 @@
#' @seealso \url{https://cloud.google.com/iam/docs/creating-managing-service-accounts#iam-service-accounts-create-rest}
#'
#' @export
#' @family IAM functions
#' @examples
#'
#' \dontrun{
#'
#' gar_service_provision("my-service-account",
Expand Down Expand Up @@ -54,7 +54,10 @@ gar_service_provision <- function(accountId,
#'
#' @return If it already exists, returns it via \link{gar_service_get}, else creates the service key
#'
#' @seealso Combine these functions to provision emails in one step with \link{gar_service_provision}
#'
#' @export
#' @family IAM functions
gar_service_create <- function(
accountId,
projectId,
Expand All @@ -64,11 +67,13 @@ gar_service_create <- function(

candidate <- sprintf("%s@%s.iam.gserviceaccount.com",
accountId, projectId)
tryCatch(

o <- tryCatch(
gar_service_get(candidate, projectId = projectId),
error = function(err){
need_one <- grepl(paste(candidate, "does not exist"), err$message)

# watch out if they update the error message #197
need_one <- grepl(paste("Not found"), err$message)
if(need_one){
myMessage("Creating new service account: ", candidate, level = 3)
the_url <- sprintf(
Expand All @@ -93,6 +98,7 @@ gar_service_create <- function(
stop(err$message)
}
})
o

}

Expand Down
16 changes: 10 additions & 6 deletions R/set_client.R
Expand Up @@ -97,7 +97,7 @@ gar_set_client <- function(json = Sys.getenv("GAR_CLIENT_JSON"),
Sys.setenv("GAR_WEB_CLIENT_SECRET" = web_json_content$web$client_secret)
Sys.setenv("GAR_SCOPES" = paste(scopes, collapse = ","))

project_id <- web_json_content$web$project_id
web_project_id <- web_json_content$web$project_id

}

Expand All @@ -121,9 +121,9 @@ gar_set_client <- function(json = Sys.getenv("GAR_CLIENT_JSON"),


if(web_json != "" && json != ""){
if(web_json_content$web$project_id != the_json$installed$project_id){
if(web_project_id != the_json$installed$project_id){
warning("Web and offline projects don't match:",
"Web:", web_json_content$web$project_id,
"Web:", web_project_id,
"Installed:", the_json$installed$project_id,
call. = FALSE)
}
Expand All @@ -135,13 +135,17 @@ gar_set_client <- function(json = Sys.getenv("GAR_CLIENT_JSON"),
}

myMessage("\noptions(googleAuthR.scopes.selected=c('",
paste(getOption("googleAuthR.scopes.selected"), collapse = "','"),"'))",
paste0(getOption("googleAuthR.scopes.selected"), collapse = "','"),"'))",
"\noptions(googleAuthR.client_id='", getOption("googleAuthR.client_id"),"')",
"\noptions(googleAuthR.client_secret=' ", getOption("googleAuthR.client_secret"),"')",
"\noptions(googleAuthR.client_secret='", getOption("googleAuthR.client_secret"),"')",
"\noptions(googleAuthR.webapp.client_id='", getOption("googleAuthR.webapp.client_id"),"')",
"\noptions(googleAuthR.webapp.client_secret=' ", getOption("googleAuthR.webapp.client_secret"),"')",
"\noptions(googleAuthR.webapp.client_secret='", getOption("googleAuthR.webapp.client_secret"),"')",
level = 2)

if(activate == "web"){
return(web_project_id)
}

project_id

}
2 changes: 1 addition & 1 deletion R/shiny-modifyurl.R
Expand Up @@ -78,7 +78,7 @@ workout_redirect <- function(req){
#'
#' @export
#'
#' @author Based on a gist by Joe Cheng, RStudio
#' @author Based on \href{https://gist.github.com/jcheng5/44bd750764713b5a1df7d9daf5538aea}{this gist} by Joe Cheng, RStudio
#'
#' @examples
#'
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -39,7 +39,7 @@ Use it within your own function definitions, to query the Google API you want.

Auto-build libraries for Google APIs with OAuth2 for both local and Shiny app use.

Get more details at the [googleAuthR website](http://code.markedmondson.me/googleAuthR/)
Get more details at the [googleAuthR website](https://code.markedmondson.me/googleAuthR/)

The [`googleAuthRverse`](https://googleauthrverse.slack.com) Slack team has been setup for support for using `googleAuthR` and the libraries it helps create. Sign up via this [Google form](https://goo.gl/forms/d541yrJoDFMrrSJp1) to get access.

Expand All @@ -66,8 +66,8 @@ Feel free to add your own via email or a pull request if you have used googleAut
## Thanks to

* Jenny Bryan and her work on the [googlesheets](https://github.com/jennybc/googlesheets) package that this work derives from.
* Hadley Wickham for [httr's OAuth2](https://github.com/hadley/httr) excellence
* RStudio team for [Shiny](http://shiny.rstudio.com/)
* Hadley Wickham for [httr's OAuth2](https://github.com/r-lib/httr) excellence
* RStudio team for [Shiny](https://shiny.rstudio.com/)
* [Johann de Boer](https://github.com/jdeboer) for some code contributions.

## Install
Expand Down

0 comments on commit 1dba9ce

Please sign in to comment.