Skip to content

Commit 2be4e7a

Browse files
committed
add templates
1 parent 9397b9d commit 2be4e7a

5 files changed

Lines changed: 68 additions & 0 deletions

File tree

templates/base.html

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<title>twauth-web sample app {% block title %}{% endblock %}</title>
5+
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
6+
</head>
7+
8+
<body>
9+
<div class="container">
10+
<h1>twauth-web</h1>
11+
{% block containercontent %}{% endblock %}
12+
<hr>
13+
<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>
15+
</div>
16+
</div>
17+
</body>
18+
</html>

templates/callback-success.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% extends "base.html" %}
2+
{% block title %}success{% endblock %}
3+
{% block containercontent %}
4+
<h2>success</h2>
5+
<p>Thank you, <strong>{{ name }}</strong>, for authorizing twauth-web an access token for <a href="https://twitter.com/{{ screen_name }}">@{{ screen_name }}</a>. We've successfully received your access token and confirmed it by retrieving some basic details on your behalf from the Twitter REST API. Yay!</p>
6+
<p>Here is what we pulled from the API on your behalf:</p>
7+
<ul>
8+
<li>You have Tweeted <span class="label label-success">{{ statuses_count }}</span> times.</li>
9+
<li>You have <span class="label label-success">{{ followers_count }}</span> followers.</li>
10+
<li>You follow <span class="label label-success">{{ friends_count }}</span> handles.</li>
11+
</ul>
12+
<p>That's it, there's nothing left for you in this demo. Now, because this is a demo and we don't want to access your data any longer, we've deleted our local copy of your token. You can be extra safe and revoke our token from your <a href="https://twitter.com/settings/applications">account settings</a> on Twitter.</p>
13+
<a href="/" class="btn btn-small btn-primary">Let me try again</a>
14+
{% endblock %}

templates/error.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{% extends "base.html" %}
2+
{% block title %}error{% endblock %}
3+
{% block containercontent %}
4+
<h2>error</h2>
5+
<div class="panel panel-danger">
6+
<div class="panel-heading">
7+
<h3 class="panel-title">Yikes, something went wrong!</h3>
8+
</div>
9+
<div class="panel-body">{{ error_message }}</div>
10+
</div>
11+
<a href="/" class="btn btn-small btn-primary">Let me try again</a>
12+
{% endblock %}

templates/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% extends "base.html" %}
2+
{% block containercontent %}
3+
<p class="lead">Welcome to the twauth-web sample. This will show a basic demo of the standard Twitter 3-legged application authorization flow.</p>
4+
<div class="hero-unit">
5+
<p>To get started, we'll need you to authorize twauth-web to access your Twitter account. More information on what is required is available from Twitter's <a href="https://dev.twitter.com/docs/auth/oauth">OAuth</a> overview.</p>
6+
<p>Here's our plan:</p>
7+
<ol>
8+
<li>We're going to generate an OAuth request token that we will use when sending you to Twitter to grant us access.</li>
9+
<li>Then we will redirect you to Twitter.com using our tokens from step 1, for you to authorize our app.</li>
10+
<li>While at Twitter.com you will authorize twauth-web and you'll then be redirected back to us.</li>
11+
<li>We will consume the OAuth params passed to our callback URL when you are redirected back to us. Using those params we will get your auth token from the Twitter API.</li>
12+
<li>Finally, to confirm that all has been authorized, we'll call the Twitter API to get jaakko to show we are able to retrieve this data on your behalf.</li>
13+
</ol>
14+
</div>
15+
<p>Ready to give this a shot?</p>
16+
<a href="/start" class="btn btn-small btn-success">Let's Begin</a>
17+
{% endblock %}

templates/start.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{% extends "base.html" %}
2+
{% block title %}start{% endblock %}
3+
{% block containercontent %}
4+
<h2>start</h2>
5+
<p>We've generated the OAuth request token (<code>{{ oauth_token }}</code>) and are ready for you to authorize <strong>twauth-web</strong>! Just click the button below, you'll be taken to Twitter to login (if you aren't already) and to grant access to <strong>twauth-web</strong>. Afterward you'll be redirected back to us.</p>
6+
<a href="{{ authorize_url }}?oauth_token={{ oauth_token }}" class="btn btn-small btn-success">Authorize twauth-web</a>
7+
{% endblock %}

0 commit comments

Comments
 (0)