def before_request(): g.user = None if "access_token" in session: user = User() try: user.load(session["access_token"][0]) g.user = user except TokenInvalid: pass
def get_token(): access_token = session.get('access_token') if access_token is None: return redirect(url_for('google_auth.login')) access_token = access_token[0] user = User() try: resp = user.load(access_token) except TokenInvalid: session.pop('access_token', None) return redirect(url_for('google_auth.login')) return resp