5

I had the exactly same issues as described in this question, in which I got similar errors. But I've followed instructions, changing the callback url and a new issue came up. I get to the authorization part through my browser but I keep getting stuck in loading page with the the warning "Redirecting you back to the application. This may take a few moments." and instead of being redirected, the browser stops and warns that it can't reach the page - also, RStudio crashes right after it. What should I do? I tried searching for similar questions, but I haven't been able to find a solution.

Although this a bit repetitive, here it is the code in R:

library(twitteR)

Consumer_key <- "key"
Consumer_secret <- "secret"

setup_twitter_oauth(Consumer_key,Consumer_secret, access_token=NULL,access_secret=NULL)

[1] "Using browser based authentication"
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
John Doe
  • 212
  • 1
  • 9
  • 28

1 Answers1

1

I had this problem but in node.js, it was because I wasn't calling the passport callback function once Twitter was done with my authentication

Not sure if this helps, but here's what fixed it.

passport.use(new TwitterStrategy({
    consumerKey: process.env.TWITTER_CONSUMER_KEY,
    consumerSecret: process.env.TWITTER_CONSUMER_SECRET,
    callbackURL: "http://127.0.0.1:8080/passport/twitter/callback"
}, function(token, tokenSecret, profile, cb) {
    // debug(token);
    // debug(tokenSecret);
    // debug(profile);
    cb(); // Was missing this line
}));
martinedwards
  • 5,577
  • 1
  • 33
  • 35
  • Hi, Could you add some details on cb() function?. I'm using Python to get authorization URL, and if I click the it, I also get stuck at the same step. – Seungjun Mar 07 '22 at 08:04