diff --git a/DESCRIPTION b/DESCRIPTION index 5ee1d34..e54feb2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -19,7 +19,7 @@ URL: https://docs.ropensci.org/osmapiR/, BugReports: https://github.com/ropensci/osmapiR/issues Imports: curl, - httr2, + httr2 (>= 1.0.6), xml2 Suggests: httptest2, diff --git a/NEWS.md b/NEWS.md index 682cfbd..42bc72d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # osmapiR (development version) +* Use the new function `httr2::oauth_cache_clear()` from httr2 1.0.6 (#58 by @hadley). + # osmapiR 0.2.1 * Update CITATION with the JOSS article (). diff --git a/R/osmapiR_connection.R b/R/osmapiR_connection.R index 9acd80c..61bda87 100644 --- a/R/osmapiR_connection.R +++ b/R/osmapiR_connection.R @@ -158,9 +158,11 @@ authenticate_osmapi <- function() { #' @rdname authenticate_osmapiR #' @export logout_osmapi <- function() { - req <- httr2::request(base_url = get_osmapi_url()) - req <- oauth_request(req) - req$policies$auth_oauth$cache$clear() + httr2::oauth_cache_clear( + client = oauth_client_osmapi(), + cache_disk = getOption("osmapir.cache_authentication"), + cache_key = getOption("osmapir.base_api_url") + ) message("Logged out from ", get_osmapi_url())