Skip to content

Commit 0bf4f26

Browse files
do not cache oauth2 by default
1 parent 62f8575 commit 0bf4f26

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

R/qbms.R

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,16 +597,19 @@ set_token <- function(token, user = '', expires_in = NULL) {
597597
#' @param client_id Consumer key, also sometimes called the client ID.
598598
#' @param client_secret Consumer secret, also sometimes called the client secret.
599599
#' @param redirect_uri The URL that user will be redirected to after authorization is complete (default is http://localhost:1410).
600+
#' @param oauth2_cache A logical value or a string. TRUE means to cache using the default cache file .httr-oauth, FALSE means don't cache,
601+
#' and NA means to guess using some sensible heuristics. A string means use the specified path as the cache file.
602+
#' Default is FALSE (i.e., don't cache).
600603
#' @return no return value
601604
#' @author Khaled Al-Shamaa, \email{k.el-shamaa@cgiar.org}
602605
#' @export
603606

604-
oauth2_login <- function(authorize_url, access_url, client_id, client_secret = NULL, redirect_uri = "http://localhost:1410") {
607+
oauth2_login <- function(authorize_url, access_url, client_id, client_secret = NULL, redirect_uri = "http://localhost:1410", oauth2_cache = FALSE) {
605608
app <- httr::oauth_app(appname = "QBMS", key = client_id, secret = client_secret, redirect_uri = redirect_uri)
606609

607610
endpoint <- httr::oauth_endpoint(authorize = authorize_url, access = access_url)
608611

609-
token <- httr::oauth2.0_token(endpoint, app)
612+
token <- httr::oauth2.0_token(endpoint, app, cache = oauth2_cache)
610613

611614
set_token(token$credentials$id_token, '', token$credentials$expires_in)
612615
}

man/oauth2_login.Rd

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)