diff --git a/docs/index.rst b/docs/index.rst index e1da1e2..fcd48c3 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -121,6 +121,11 @@ redirected back to. For example:: return twitter.authorize(callback=url_for('oauth_authorized', next=request.args.get('next') or request.referrer or None)) +For the callback to work, you must set a placeholder "Callback URL" in your +app's "Settings" tab at https://dev.twitter.com. The URL configured in this +settings page isn't actually used, but not setting it will prevent the +authorize() call mentioned above from working. + If the application redirects back, the remote application will have passed all relevant information to the `oauth_authorized` function: a special response object with all the data, or ``None`` if the user denied the diff --git a/flask_oauth.py b/flask_oauth.py index b21105a..8193860 100644 --- a/flask_oauth.py +++ b/flask_oauth.py @@ -295,8 +295,10 @@ def generate_request_token(self, callback=None): self.expand_url(self.request_token_url), callback, self.request_token_params) if not self.status_okay(resp): - raise OAuthException('Failed to generate request token', - type='token_generation_failed') + msg = "Failed to generate request token." \ + + " Response code: '%s', response content: '%s'" \ + % (resp['status'], content) + raise OAuthException(msg, type='token_generation_failed') data = parse_response(resp, content) if data is None: raise OAuthException('Invalid token response from ' + self.name,