@app.route('/login/callback', methods=['GET'])
def callback():
    ' Step 3: Retrieving an access token.\n\n    The user has been redirected back from the provider to your registered\n    callback URL. With this redirection comes an authorization code included\n    in the redirect URL. We will use that to obtain an access token.\n    '
    token_dict = app.config['auth_client'].grab_access_token_and_refresh_token(url=request.url)
    session['oauth_token'] = token_dict
    if app.config['call_close']:
        return redirect(url_for('shutdown'))
    return jsonify(token_dict)
Step 3: Retrieving an access token.

The user has been redirected back from the provider to your registered
callback URL. With this redirection comes an authorization code included
in the redirect URL. We will use that to obtain an access token.
@app.route('/login/callback', methods=['GET'])
def callback():
    ' Step 3: Retrieving an access token.\n\n    The user has been redirected back from the provider to your registered\n    callback URL. With this redirection comes an authorization code included\n    in the redirect URL. We will use that to obtain an access token.\n    '
    token_dict = app.config['auth_client'].grab_access_token_and_refresh_token(url=request.url)
    session['oauth_token'] = token_dict
    if app.config['call_close']:
        return redirect(url_for('shutdown'))
    return jsonify(token_dict)