def account_setup(remote, token, resp):
    """Perform additional setup after user have been logged in.

    :param remote: The remote application.
    :param token: The token value.
    :param resp: The response.
    """
    info = get_user_info(remote)
    user_id = get_user_id(remote, info['preferred_username'])
    with db.session.begin_nested():

        token.remote_account.extra_data = {
            'login': info['username'],
            'id': user_id}

        # Create user <-> external id link.
        oauth_link_external_id(
            token.remote_account.user, dict(
                id=user_id,
                method=GLOBUS_EXTERNAL_METHOD)
        )
def account_setup ( remote , token , resp ) : info = get_user_info ( remote ) user_id = get_user_id ( remote , info [ 'preferred_username' ] ) with db . session . begin_nested ( ) : token . remote_account . extra_data = { 'login' : info [ 'username' ] , 'id' : user_id } oauth_link_external_id ( token . remote_account . user , dict ( id = user_id , method = GLOBUS_EXTERNAL_METHOD ) )
Perform additional setup after user have been logged in.

    :param remote: The remote application.
    :param token: The token value.
    :param resp: The response.