Skip to content

Commit

Permalink
version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Edmondson authored and cran-robot committed Jan 28, 2022
1 parent 7062d00 commit 4554d96
Show file tree
Hide file tree
Showing 30 changed files with 323 additions and 1,994 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,6 +1,6 @@
Package: googleAuthR
Type: Package
Version: 1.4.1
Version: 2.0.0
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 @@ -27,7 +27,7 @@ License: MIT + file LICENSE
VignetteBuilder: knitr
RoxygenNote: 7.1.2
NeedsCompilation: no
Packaged: 2021-12-17 16:23:53 UTC; mark
Packaged: 2022-01-28 10:00:15 UTC; mark
Author: Mark Edmondson [aut, cre] (<https://orcid.org/0000-0002-8434-3881>),
Jennifer Bryan [ctb],
Johann deBoer [ctb],
Expand All @@ -36,4 +36,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: 2021-12-17 16:40:02 UTC
Date/Publication: 2022-01-28 10:20:02 UTC
50 changes: 21 additions & 29 deletions MD5
@@ -1,22 +1,21 @@
36adecd7ba96ee76d976fcee74409f3f *DESCRIPTION
df26c915413ce2e5d355e46031a9c317 *DESCRIPTION
28bd6318a320b06c793dd1288a760bc5 *LICENSE
f23827d4274e1ea1aa63b5662330d018 *NAMESPACE
cec4ad1d5bf4a184c45ae154353bb41c *NEWS.md
186651c5123690d706cf55282f2e8198 *R/auth.R
a806f6b872b20c84d020ab32e0b4986d *NAMESPACE
2c40dadc3c31f1a7e6ebf78babe9ed2e *NEWS.md
7eed323e6ae7f34974636672c8496d16 *R/auth.R
2528fc1012892cdddf6308f4570b4b08 *R/auth_gargle.R
0e0b5f072d3c78b15a9f2f22bfd63ee0 *R/auth_legacy.R
3ad3f642fbb73d758f4600cf9dc6df34 *R/auto_auth.R
c0544079f00dda17229b20f4d6bb5003 *R/batch.R
c53c999253a995c305aa19bc3983143d *R/checks.R
e02dc9f29c32ed52a5bbb190e29b7142 *R/batch.R
69c8892a064ba18df44deb450f2c1b11 *R/checks.R
c5f715bf2ff270a98e65b2fff6001b64 *R/debugging.R
48f46faa47a4ea69f60a35477225003e *R/discovery.R
47d3e06d6dbe06e2525c8e016a1de360 *R/discovery_build.R
d3a1c7c92e26bd965f943a913b55677d *R/discovery_utilities.R
2b8fab39b6d305cf7040cc55e6cb3bd5 *R/gadget.R
9f30cacd6d7c1c6d1534701debaadf2e *R/gce.R
bf0af8cd4dda505405b93d1aa8a89544 *R/generator.R
0b8529c66c0d3274b03c1c1f19ba9644 *R/generator.R
67bb1480bf60cfc8f8dd4297011a9b4b *R/googleAuthR.R
2b47604319595f4afcbe293c343c7aff *R/memoise.R
5fb3590ac65cf4147a68c5ea472972b4 *R/memoise.R
648604f3dba68eb9755f758c3f45e3e6 *R/new_batch.R
c1c88c277974976a4de749ffeb7b5f7a *R/options.R
2ea9fc7feab2ce6f136f7e799de8fd99 *R/page_results.R
Expand All @@ -25,32 +24,30 @@ d1dadfe77089350727ef0621373954df *R/service_creation.R
c04412299645b30032f119c85e6d082e *R/set_client.R
f338e9c2a627e1144a233b34df0a24cd *R/setup_wizard.R
4d0b56a28603bc85f969d75c0c5fe0bc *R/setup_wizard_auth.R
bd9fc50abca8114256a50c98cbecbc8f *R/shiny-auth.R
030b66b8909d12b743d5bc77628e1359 *R/shiny-js-auth.R
be4bdd6a8f57a02f8828836b82bb8c7a *R/shiny-js-auth.R
2b5498f2ffb93cef1c3f6949d4d87e46 *R/shiny-js-signin.R
493f56f14dfebc1bb5a84a581035067b *R/shiny-modifyurl.R
3d48f5aaa98345d1be9cfe03dff1ad28 *R/shiny.R
1df3fea943fd3d1c4b96d3cb898e6a88 *R/shiny.R
5840bed076148953b7c4ae41212c9d4b *R/test-helpers.R
3271987cca4198d0a1116c9dcc073cf0 *R/utility.R
c77b8f4c1a33c7ac0ef6a052caea2833 *R/utility.R
8d1c7e558b00cc60f9ebbc8a62eeacf7 *README.md
c0e4e09709cb1785cf6cb5f43c540981 *build/vignette.rds
ef476c247c435987f52f5859d17e95b7 *inst/css/button.css
9b09e1f3ca80363749b7c8c6279b1ef3 *inst/doc/advanced-building.Rmd
e0397ed1c3a10ee2eb2891ff2999c9ab *inst/doc/advanced-building.html
a9d513c99edf0700448b869b667fc600 *inst/doc/advanced-building.html
7d2bf9a070a424e8c600743ac60e6bc1 *inst/doc/building.Rmd
cdd9e78ad35c8d398675b18341dd5ed9 *inst/doc/building.html
06246fb7fb80a76fb0398e74fe7039c5 *inst/doc/google-authentication-types.Rmd
93b21f8ac03641d56131f6d13f5cee59 *inst/doc/google-authentication-types.html
fb8b8a6fcc0af5dc1f63e80e92884e08 *inst/doc/building.html
7b25024dac08cd7e83c8b6e7643d8b53 *inst/doc/google-authentication-types.Rmd
d623f56d16c728a9813acfcdab4fd076 *inst/doc/google-authentication-types.html
c82ec4beb7ec49e7212ec285fdcf5370 *inst/doc/setup.Rmd
c7187f37f85de371f9682ef55b53670c *inst/doc/setup.html
6307bc5977bf511c1bef747028ec5329 *inst/doc/setup.html
d8d8383db9b30fce4a31af51a7725043 *inst/doc/troubleshooting.Rmd
06871a99323fae64a28330fe3cef3219 *inst/doc/troubleshooting.html
ad9ac4b5b6f0bbcd531b765ccb379e87 *inst/doc/troubleshooting.html
a3f9b806f1ed4baf006d50611078b575 *inst/googledrive_shiny_demo/listGoogleDrive/app.R
477376d302911be898d715e94ca58a88 *inst/img/google_logo.png
cf8bfce980636f2aced78d8e6cddc1ae *inst/js/js-auth.js
bad8980bae563a7311c2a4a739805f55 *inst/js/signin-bottom.js
d8186cc89cb858dc53498aea6453b3f8 *inst/js/signin-top.js
12107bd3b218f8c8ddc0dcde02af2694 *inst/js_auth_demo/app.R
761989e6c0b28193e73f42656c57ae24 *inst/rstudio/addins.dcf
1392335e023f8b7d669720c26a9c7895 *inst/server_side_auth_demo/DESCRIPTION
1c95396837c15b7e8a601a4f08220b69 *inst/server_side_auth_demo/readme.md
Expand All @@ -61,8 +58,8 @@ c7cc05b9881e74b690a7aea65cbbdac7 *inst/server_side_auth_demo/server.R
c9e15fc3dab394e253513c55aca51758 *inst/server_side_auth_function/readme.md
6e74c89994f0aee18be824f72e06580e *inst/signin_demo/app/app.R
e5f3712d8f27e01a9036db0f84ddad35 *man/checkGoogleAPIError.Rd
bcc3974f3027710ed4fd4c71c6d9b3fe *man/checkTokenAPI.Rd
0302ceb30b874a8147316c61b05d2c8c *man/doHttrRequest.Rd
f00448f82ac055d71d0a2bc78384e107 *man/checkTokenAPI.Rd
5a923838b5b016b24f886506b54ed2cc *man/doHttrRequest.Rd
30c7c50f816fbb61a80972b4791b5b03 *man/gar_api_generator.Rd
5b458ed8e42d15c38057fb0e690a85a0 *man/gar_api_page.Rd
4a41b37c2a42fa007cf4a8f606b512af *man/gar_attach_auto_auth.Rd
Expand Down Expand Up @@ -103,21 +100,16 @@ e4393841428564c05f5ceadc53799e2e *man/gar_setup_get_authenv.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
86c7814cf594ae3ba93295764ab71a0f *man/get_google_token.Rd
da6bd85df71ccdb451f35d72dea221bc *man/googleAuthR.Rd
f658701c0fb6eb3fff94a1b75d9a697e *man/googleAuthUI.Rd
fd23c41ea81c7c986c6acdf4325e46ed *man/googleAuth_js.Rd
21f2658b684c4b7787cc549afd5e9ea1 *man/googleAuth_jsUI.Rd
9d44b77ffd34d3d429b282cb7cec322d *man/googleSignIn.Rd
688329f9de6d386307c03d4f3a505089 *man/googleSignInUI.Rd
8d9e85588fa5da53690f7fcb1379416f *man/retryRequest.Rd
ced615833e75dfef29f3f4ebd6c82e80 *man/silent_auth.Rd
c659165619e07515dc629f7a03f9e22e *man/skip_if_no_env_auth.Rd
c6c8c7e14db01b1f0f656dfccda90e2d *man/token_exists.Rd
e7a84853084c59a8723a9b7f85d652e7 *man/with_shiny.Rd
9b09e1f3ca80363749b7c8c6279b1ef3 *vignettes/advanced-building.Rmd
7d2bf9a070a424e8c600743ac60e6bc1 *vignettes/building.Rmd
06246fb7fb80a76fb0398e74fe7039c5 *vignettes/google-authentication-types.Rmd
7b25024dac08cd7e83c8b6e7643d8b53 *vignettes/google-authentication-types.Rmd
c82ec4beb7ec49e7212ec285fdcf5370 *vignettes/setup.Rmd
d8d8383db9b30fce4a31af51a7725043 *vignettes/troubleshooting.Rmd
7 changes: 2 additions & 5 deletions NAMESPACE
Expand Up @@ -51,18 +51,15 @@ export(gar_shiny_login_ui)
export(gar_shiny_ui)
export(gar_token)
export(gar_token_info)
export(googleAuth)
export(googleAuthUI)
export(googleAuth_js)
export(googleAuth_jsUI)
export(googleSignIn)
export(googleSignInUI)
export(silent_auth)
export(skip_if_no_env_auth)
export(with_shiny)
import(assertthat)
import(cli)
import(memoise)
importFrom(assertthat,assert_that)
importFrom(assertthat,is.string)
importFrom(cli,cli_alert_danger)
importFrom(cli,cli_alert_info)
importFrom(cli,cli_alert_success)
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
@@ -1,3 +1,8 @@
# googleAuthR 2.0.0

* Removed `with_shiny()` and `googleAuth` modules that have been deprecated for a while -use `gar_shiny_*` instead.
* Improved error handling with custom http errors

# googleAuthR 1.4.1

* Fix `gar_service_create()` and dependent functions since error message changed for service email (#197)
Expand Down
7 changes: 1 addition & 6 deletions R/auth.R
Expand Up @@ -192,18 +192,13 @@ is.token2.0 <- function(x){
#' @keywords internal
#' @family authentication functions
#' @importFrom httr config
get_google_token <- function(shiny_return_token=NULL) {
get_google_token <- function() {

if(any(which(grepl("with_mock_API", as.character(sys.calls()))))){
myMessage("Skipping token checks as using with_mock_API", level = 3)
return(NULL)
}

# shiny auth provides its own token
if(!is.null(shiny_return_token)){
return(config(token = shiny_return_token))
}

gar_token()

}
Expand Down
5 changes: 2 additions & 3 deletions R/batch.R
Expand Up @@ -65,8 +65,7 @@ gar_batch <- function(function_list,

parsed <- paste(c(parse_list, "--gar_batch--"), collapse="")

l <- list(parsed = parsed,
shiny_access_token = function_list[[1]]$shiny_access_token)
l <- list(parsed = parsed)

## call doHttrRequest with batched together functions
cached_call <- !is.null(gar_cache_get_loc())
Expand Down Expand Up @@ -419,7 +418,7 @@ doBatchRequest <- function(batched,
}

arg_list <- list(url = batch_endpoint,
config = get_google_token(batched$shiny_access_token),
config = get_google_token(),
body = batched$parsed,
encode = "multipart",
add_headers("Accept-Encoding" = "gzip"),
Expand Down
32 changes: 9 additions & 23 deletions R/checks.R
Expand Up @@ -128,13 +128,11 @@ token_exists <- function() {

#' Check API data token
#'
#' @param shiny_access_token auth token
#'
#' @return boolean if it works.
#'
#' @keywords internal
#' @family data fetching functions
checkTokenAPI <- function(shiny_access_token=NULL){
checkTokenAPI <- function(){

if(any(which(grepl("with_mock_API",
as.character(sys.calls()), ignore.case = FALSE)))){
Expand All @@ -147,27 +145,15 @@ checkTokenAPI <- function(shiny_access_token=NULL){
return(TRUE)
}

if(is.null(shiny_access_token)){
## local token
token <- .auth$cred

if(token_exists() && is_legit_token(token)) {
myMessage("Valid local token", level = 1)
return(TRUE)
} else {
myMessage("Invalid local token", level = 1)
return(FALSE)
}

## local token
token <- .auth$cred

if(token_exists() && is_legit_token(token)) {
myMessage("Valid local token", level = 1)
return(TRUE)
} else {
## is it a valid shiny token passed?
if(is_legit_token(shiny_access_token)){
myMessage("Valid Shiny token", level = 1)
return(TRUE)
} else {
myMessage("Invalid Shiny token", level = 1)
return(FALSE)
}
myMessage("Invalid local token", level = 1)
return(FALSE)
}

}
Expand Down

0 comments on commit 4554d96

Please sign in to comment.