Hi, I was trying Twitter Quickstart from the flask-dance documentation and for some reason it isn't working
Here's my code
twitter_blueprint = make_twitter_blueprint(api_key=app.config.get("twitter_api_key"),
api_secret=app.config.get("twitter_api_secret"))
app.register_blueprint(twitter_blueprint, url_prefix='/login')
@app.route('/')
def twitter_login():
print("Incoming Request")
print(dir(twitter))
if not twitter.authorized:
print("Redirecting")
return redirect(url_for('twitter.login'))
print("Getting Account Info")
account_info = twitter.get('account/settings.json')
if account_info.ok:
account_info = account_info.json()
return f"<h1>Your twitter name is {account_info['screen_name']}</h1>"
when redirecting using return redirect(url_for('twitter.login')) i get the following error
OAuth 1 request token error: Token request failed with code 403, response was '<?xml version='1.0' encoding='UTF-8'?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>'.
I even set the callback url in twitter developer portal just as mentioned
http://localhost:5000/login/twitter/authorized
EDIT: it was something wrong with localhost twitter asks to mention 127.0.0.1
Hi, I was trying Twitter Quickstart from the flask-dance documentation and for some reason it isn't working
Here's my code
when redirecting using
return redirect(url_for('twitter.login'))
i get the following errorOAuth 1 request token error: Token request failed with code 403, response was '<?xml version='1.0' encoding='UTF-8'?><errors><error code="415">Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings</error></errors>'.
I even set the callback url in twitter developer portal just as mentionedhttp://localhost:5000/login/twitter/authorized
EDIT: it was something wrong with localhost twitter asks to mention 127.0.0.1