Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer authenticate with twitter oauth2 #319

Closed
guga31bb opened this issue Sep 15, 2023 · 1 comment
Closed

Can no longer authenticate with twitter oauth2 #319

guga31bb opened this issue Sep 15, 2023 · 1 comment
Labels
bug an unexpected problem or unintended behavior oauth 🔒
Milestone

Comments

@guga31bb
Copy link

Somewhere along the way, the development version of httr2 seems to have broken authentication with twitter and oauth2. This is possibly related to #316.

ID <- "XXX"
SECRET <- "YYYY"

client <- httr2::oauth_client(
  id = ID,
  secret = SECRET,
  token_url = "https://api.twitter.com/2/oauth2/token",
  auth = "header",
  name = "rtweet")

# most recent commit: does not work
  remove.packages("httr2")
  remotes::install_github("r-lib/httr2@8f77d4145a7d887e7f30c449f28cda150a61d744")
  
  token <- httr2::oauth_flow_auth_code(client,
                                       auth_url = "https://twitter.com/i/oauth2/authorize",
                                       pkce = TRUE,
                                       scope = "tweet.write",
                                       host_name = "127.0.0.1", port = 1410 # also does not work: redirect_uri = "http://127.0.0.1:1410/"
  )
  

  [R Console] Enter authorization code: 
  [Browser after clicking confirm]  This site can’t be reached 127.0.0.1 refused to connect.    ERR_CONNECTION_REFUSED

# july 12 commit: does work
  remove.packages("httr2")
  remotes::install_github("r-lib/httr2@7f795cd4ae688ad71c445b8b3225e1a65fdf6b0a")

  token <- httr2::oauth_flow_auth_code(client,
                                       auth_url = "https://twitter.com/i/oauth2/authorize",
                                       pkce = TRUE,
                                       scope = "tweet.write",
                                       host_name = "127.0.0.1",
                                       port = 1410
  )
  
  [R Console] Waiting for authentication in browser...
  [Browser after clicking confirm]  Authentication complete. Please close this page and return to R.

The behavior is identical through launching the browser (i.e., they both open the same browser to the same URL, aside from state/code challenge), but something is going wrong after clicking confirm in the new version. The behavior is identical in both chrome and edge.

@hadley hadley added bug an unexpected problem or unintended behavior oauth 🔒 labels Sep 28, 2023
@hadley hadley added this to the v0.3.0 milestone Sep 28, 2023
@llrs llrs mentioned this issue Oct 6, 2023
@hadley
Copy link
Member

hadley commented Oct 8, 2023

Should be fixed by a11c290

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior oauth 🔒
Projects
None yet
Development

No branches or pull requests

2 participants