Problem with Oauth2 authentication in rtweet

326 Views Asked by At

I'm having some problems implementing OAuth2 authentication with the rtweet library, when I try to start the process I get the error "The default rtweet client is no longer authorized."

client <- rtweet_client(app = "app_name") (I have tried with the name and with the ID),

When running rtweet_client I get the error:

Error in default_client(): The default rtweet client is no longer authorized. i You'll need to register as a developer in order to use the Twitter API.

I also tried to pass the client_id and client_secret, in that case the same error is returned when executing rtweet_oauth2().

In the developer section of twitter I have registered the application with read/write permissions, everything as it is perfectly described in https://docs.ropensci.org/rtweet/articles/auth.html.

Can you help me?

1

There are 1 best solutions below

1
Jorge Pradas On

Finally I solved the problem:

client<-rtweet_client(client_id="cmgxYjMxxxxxxxxxxx", 
                      client_secret = "cUb6o3b2zxxxxxxxxxxxx", 
                      app = "xxxxxxxxxxxxxx")

client_as(client)
auth2<- rtweet_oauth2()

tweet_post("test")

Although the authorization is now only valid for two hours...