def METHOD_NAME(connection):
    if connection.auth_type != OAUTH2_PWD:
        return
    api_settings = AUTH_PRESETS[connection.api_auth_settings]
    connection.token_url = get_endpoint_url(connection.url, api_settings.token_endpoint)
    connection.refresh_url = get_endpoint_url(connection.url, api_settings.refresh_endpoint)
    connection.pass_credentials_in_header = api_settings.pass_credentials_in_header
    connection.save()