import config

__author__ = 'hanl'

from flask import Flask, redirect, url_for, session, request, jsonify
from flask_oauthlib.client import OAuth

app = Flask(__name__)
app.debug = True
app.secret_key = 'development'
oauth = OAuth(app)
korap = oauth.remote_app(
    'korap',
    consumer_key=config.OAUTH2_CLIENT_ID,
    consumer_secret=config.OAUTH2_CLIENT_SECRET,
    request_token_params={},
    base_url='https://localhost:8443/api/v0.1',
    request_token_url=None,
    access_token_method='POST',
    access_token_url='https://localhost:8443/api/v0.1/oauth2/token',
    # should be a website of this flask application
    authorize_url='https://localhost:8443/api/v0.1/oauth2/authorize',
)


@app.route('/')
def index():
    if 'dropbox_token' in session:
        me = korap.get('user/info')
        return jsonify(me.data)
    return redirect(url_for('login'))


@app.route('/login')
def login():
    return korap.authorize(callback=url_for('authorized', _external=True))


@app.route('/logout')
def logout():
    session.pop('korap_token', None)
    return redirect(url_for('index'))


@app.route('/login/authorized')
def authorized():
    resp = korap.authorized_response()
    if resp is None:
        return 'Access denied: reason=%s error=%s' % (
        request.args['error'],
        request.args['error_description']
    )
    session['korap_token'] = (resp['access_token'], '')
    me = korap.get('user/info')
    return jsonify(me.data)


@korap.tokengetter
def get_korap_oauth_token():
    return session.get('korap_token')



if __name__ == '__main__':
    app.run()