@@ -597,16 +597,19 @@ set_token <- function(token, user = '', expires_in = NULL) {
597
597
# ' @param client_id Consumer key, also sometimes called the client ID.
598
598
# ' @param client_secret Consumer secret, also sometimes called the client secret.
599
599
# ' @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).
600
603
# ' @return no return value
601
604
# ' @author Khaled Al-Shamaa, \email{k.el-shamaa@cgiar.org}
602
605
# ' @export
603
606
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 ) {
605
608
app <- httr :: oauth_app(appname = " QBMS" , key = client_id , secret = client_secret , redirect_uri = redirect_uri )
606
609
607
610
endpoint <- httr :: oauth_endpoint(authorize = authorize_url , access = access_url )
608
611
609
- token <- httr :: oauth2.0_token(endpoint , app )
612
+ token <- httr :: oauth2.0_token(endpoint , app , cache = oauth2_cache )
610
613
611
614
set_token(token $ credentials $ id_token , ' ' , token $ credentials $ expires_in )
612
615
}
0 commit comments