def show_login(): data = { "STATE": "".join(random.choice(string.ascii_uppercase + string.digits) for _ in xrange(32)), "CLIENT_ID": config.getOAuth()["web"]["client_id"], } login_session["state"] = data["STATE"] return flask.render_template("login.html", **data)
def show_login(): data = { 'STATE': ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in xrange(32)), 'CLIENT_ID': config.getOAuth()['web']['client_id'] } login_session['state'] = data['STATE'] return flask.render_template('login.html', **data)
''' import flask import httplib2 import json import random import requests import string from flask import session as login_session from oauth2client.client import flow_from_clientsecrets from oauth2client.client import FlowExchangeError from oauth2client.client import AccessTokenCredentials import config CLIENT_ID = config.getOAuth()['web']['client_id'] def show_login(): data = { 'STATE': ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in xrange(32)), 'CLIENT_ID': config.getOAuth()['web']['client_id'] } login_session['state'] = data['STATE'] return flask.render_template('login.html', **data) def show_logout(): return flask.redirect(flask.url_for('google_logout'))
Heavily inspired by https://github.com/lingdb/flask-oauth """ import flask import httplib2 import json import random import requests import string from flask import session as login_session from oauth2client.client import flow_from_clientsecrets from oauth2client.client import FlowExchangeError import config CLIENT_ID = config.getOAuth()["web"]["client_id"] def show_login(): data = { "STATE": "".join(random.choice(string.ascii_uppercase + string.digits) for _ in xrange(32)), "CLIENT_ID": config.getOAuth()["web"]["client_id"], } login_session["state"] = data["STATE"] return flask.render_template("login.html", **data) def show_logout(): return flask.redirect(flask.url_for("google_logout"))