Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
Use client name instead of attribute.
Browse files Browse the repository at this point in the history
Based on httr2 code.

Close #791
  • Loading branch information
llrs committed Apr 15, 2024
1 parent fa9f4da commit 6fc9a96
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion R/auth.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions R/client.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6fc9a96

Please sign in to comment.