Skip to content

Commit 9d05002

Browse files
committed
accept the denied callback param
1 parent 07d6025 commit 9d05002

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>twauth-web</h1>
1111
{% block containercontent %}{% endblock %}
1212
<hr>
1313
<div class="footer">
14-
<p class="text-muted"><small>This is a basic demo created by <a href="https://twitter.com/jaakkosf">@jaakkosf</a> from the <a href="https://twitter.com/twitterapi">@twitterapi</a> team. It is written in Python, using <a href="http://flask.pocoo.org/">Flask</a> and <a href="https://github.com/simplegeo/python-oauth2">python-oauth2</a>. Basic CSS is provided by <a href="http://getbootstrap.com/">Bootstrap</a>. The source code for this project can be found on <a href="https://github.com/jaakko-sf/twauth-web">github/jaakko-sf/twauth-web</a>.</small></p>
14+
<p class="text-muted"><small>This is a basic demo created by <a href="https://twitter.com/jaakkosf">@jaakkosf</a> from the <a href="https://twitter.com/twitterapi">@twitterapi</a> team. It is written in Python, using <a href="http://flask.pocoo.org/">Flask</a> and <a href="https://github.com/simplegeo/python-oauth2">python-oauth2</a>. Basic CSS is provided by <a href="http://getbootstrap.com/">Bootstrap</a>. The source code for this project can be found at <a href="https://github.com/jaakko-sf/twauth-web">github/jaakko-sf/twauth-web</a>.</small></p>
1515
</div>
1616
</div>
1717
</body>

twauth-web.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ def callback():
5353
# Accept the callback params, get the token and call the API to display this user's name and handle
5454
oauth_token = request.args.get('oauth_token')
5555
oauth_verifier = request.args.get('oauth_verifier')
56+
oauth_denied = request.args.get('denied')
57+
58+
# if the oauth request was denied, delete our local token and show an error message
59+
if oauth_denied:
60+
if oauth_denied in oauth_store:
61+
del oauth_store[oauth_denied]
62+
return render_template('error.html', error_message="the OAuth request was denied by this user")
5663

5764
if not oauth_token or not oauth_verifier:
5865
return render_template('error.html', error_message="callback param(s) missing")

0 commit comments

Comments
 (0)