Permalink
Browse files

Add API me. Demo works.

  • Loading branch information...
lepture committed Nov 21, 2013
1 parent 060da19 commit b30339ee5df40ef75e3313587aff11d0ec67339e
Showing with 9 additions and 1 deletion.
  1. +7 −0 app.py
  2. +2 −1 client.py
View
7 app.py
@@ -243,6 +243,13 @@ def authorize(*args, **kwargs):
return confirm == 'yes'
@app.route('/api/me')
@oauth.require_oauth()
def me(req):
user = req.user
return jsonify(username=user.username)
if __name__ == '__main__':
db.create_all()
app.run()
View
@@ -26,7 +26,8 @@
@app.route('/')
def index():
if 'remote_oauth' in session:
return session['remote_oauth'][0]
resp = remote.get('me')
return jsonify(resp.data)
next_url = request.args.get('next') or request.referrer or None
return remote.authorize(
callback=url_for('authorized', next=next_url, _external=True)

0 comments on commit b30339e

Please sign in to comment.