Permalink
Browse files

Overwrite callback url to avoid the need for session

  • Loading branch information...
akariv committed Jun 25, 2017
1 parent c81ad26 commit 9167ce1a356a01d5cfc776bf7ebc6bc7c66d11a0
Showing with 9 additions and 5 deletions.
  1. +6 −3 conductor/blueprints/user/blueprint.py
  2. +3 −2 conductor/blueprints/user/controllers.py
@@ -8,6 +8,10 @@
os_conductor = os.environ.get('OS_EXTERNAL_ADDRESS')
def get_callback_url():
callback_url = 'https://'+os_conductor+url_for('oauth.callback')
def create():
"""Create blueprint.
"""
@@ -28,8 +32,7 @@ def authorize():
def check():
token = request.values.get('jwt')
next_url = request.args.get('next', None)
callback_url = 'https://'+os_conductor+url_for('oauth.callback')
return jsonpify(authenticate_controller(token, next_url, callback_url))
return jsonpify(authenticate_controller(token, next_url, get_callback_url()))
def update():
token = request.values.get('jwt')
@@ -64,7 +67,7 @@ def oauth_create():
def callback():
state = request.args.get('state')
return callback_controller(state)
return callback_controller(state, get_callback_url())
# Register routes
blueprint.add_url_rule(
@@ -12,7 +12,7 @@
import jwt
import requests
from flask import make_response, redirect
from flask import make_response, redirect, session
from flask_oauthlib.client import OAuth, OAuthException
from .models import get_permission, get_user, create_or_get_user, save_user
@@ -187,11 +187,12 @@ def _get_token_from_profile(provider, profile):
return client_token
def oauth_callback(state):
def oauth_callback(state, callback_url):
"""Callback from google
"""
try:
app = _google_remote_app()
session['%s_oauthredir' % app.name] = callback
resp = app.authorized_response()
except OAuthException as e:
resp = e

0 comments on commit 9167ce1

Please sign in to comment.