Hey guys I am trying to build this twitter bot, I am using the library tweepy. I turned on OAuth 1.0a turned on to get read and write access but I am unable to authorize the app. I am not able to get the pin value which I can use in auth.get_access_token(verifier=None)
My code :
import tweepy
import webbrowser
import time
consumer_key = "value"
consumer_secret = "value"
access_token = "value"
access_token_secret = "value"
auth = tweepy.OAuth1UserHandler(consumer_key, consumer_secret, access_token,access_token_secret )
redirect_url = auth.get_authorization_url()
print(redirect_url)
webbrowser.open(redirect_url) #stuck here as when I click authorize the app it redirects to the callback url which says "Directory listing for /?oauth_token="value"&oauth_verifier="value"
user_pint_input = input("What's the pin value?")
I have put local host 8080
as the callback url which I started through python3 -m http.server --cgi 8080
I am unsure about this callback url due to lack of info on this. I am doing it wrong. How can I rectify it? Thanks
From the Tweepy documentation here:
The PIN-based OAuth flow can be used by setting the callback parameter to "oob":
import tweepy
oauth1_user_handler = tweepy.OAuth1UserHandler(
"API / Consumer Key here", "API / Consumer Secret here",
callback="oob"
)
There is no question of callback if you use this authentication method.