def generate_authorized_url(username, session_token, redirect_to):
""" Generate URL that we'll redirect the user to once authenticated """
base_url = current_app.config['APP_BASE_URL']
redirect_query = ''
if redirect_to:
redirect_query = f'&redirect_to={urllib.parse.quote(redirect_to)}'
# Trailing & added as Angular a bit flaky with parsing querystring
authorized_url = f'{base_url}/authorized?username={urllib.parse.quote(username)}&session_token={session_token}&ng=0' \
f'{redirect_query}'
return authorized_url
评论列表
文章目录