From 6fc9a961d15e9c1f9efefdff9a0c821dfbbb2851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs?= Date: Tue, 16 Apr 2024 00:41:01 +0200 Subject: [PATCH] Use client name instead of attribute. Based on httr2 code. Close #791 --- R/auth.R | 2 +- R/client.R | 4 ++-- README.Rmd | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/R/auth.R b/R/auth.R index 19302088..3c11f24b 100644 --- a/R/auth.R +++ b/R/auth.R @@ -506,7 +506,7 @@ rtweet_oauth2 <- function(client = NULL, scopes = NULL) { # Example of valid url for authorization (created via client_as("academic_dev");rtweet_oauth2() ) # https://twitter.com/i/oauth2/authorize?response_type=code&client_id=Tm5FWFA3OGFUVUMxTjhUREwzZzQ6MTpjaQ&redirect_uri=http%3A%2F%2F127.0.0.1%3A1410%2F&scope=tweet.read%20tweet.write%20tweet.moderate.write%20users.read%20follows.read%20follows.write%20offline.access%20space.read%20mute.read%20mute.write%20like.read%20like.write%20list.read%20list.write%20block.read%20block.write%20bookmark.read%20bookmark.write&state=PVgWK3MviQ5MBsfj0Iy5D89HBFR4mPwTl0yumjSPlWo&code_challenge=FNcGvupIzNIbWOL8rdJOrxsVS_b2R01vIbynF_iQIMQ&code_challenge_method=S256 # # Note that the client_id should match in the url - attr(token, "app") <- attr(client, "app") + attr(token, "app") <- client$name token } diff --git a/R/client.R b/R/client.R index 6de18c01..ad14fa0f 100644 --- a/R/client.R +++ b/R/client.R @@ -115,7 +115,7 @@ default_cached_client <- function() { #' } client_save <- function(client) { stopifnot(is_client(client)) - name <- paste0(attr(client, "app"), ".rds") + name <- paste0(client$name, ".rds") path <- client_path(name) inform(paste0("Saving client to '", path, "'")) dir.create(client_path(), showWarnings = FALSE, recursive = TRUE) @@ -273,7 +273,7 @@ client_scopes <- function(client) { client_app <- function(client) { stopifnot(is_client(client)) - attr(client, "app", exact = TRUE) + client$name } #' Clean clients diff --git a/README.Rmd b/README.Rmd index 9f673253..b9fa53cc 100644 --- a/README.Rmd +++ b/README.Rmd @@ -32,7 +32,7 @@ Use twitter from R. **This package is no longer updated and no fixes can be expected.** A request to Orphan the package on CRAN was sent! -The maintainer cannot longer check most of the output of the functionality provided. +The maintainer cannot longer check most of the output of the functionality provided. If you want to volunteer reach out to the maintainer. ## Installation