def METHOD_NAME(
    auth_setup,
    email=None,
    password=None,
):
    currentAuthConfig = None
    # check if an auth method for this service was already set
    configs = QgsApplication.authManager().availableAuthMethodConfigs()
    previousAuthExist = False
    for config in configs.values():
        if config.name() == auth_setup.name:
            currentAuthConfig = config
            previousAuthExist = True
            break
    if not previousAuthExist:
        # not found => create a new one
        currentAuthConfig = QgsAuthMethodConfig()
        currentAuthConfig.setName(auth_setup.name)
    # reset it's config values to set later new password when received
    currentAuthConfig.setMethod("Basic")
    currentAuthConfig.setConfig("username", email)
    currentAuthConfig.setConfig("password", password)
    if not previousAuthExist:
        # store a new auth config
        if not QgsApplication.authManager().storeAuthenticationConfig(
            currentAuthConfig
        ):
            iface.messageBar().pushCritical(
                "Trends.Earth", tr_auth.tr("Cannot init auth configuration")
            )
            return None
    else:
        # update existing
        if not QgsApplication.authManager().updateAuthenticationConfig(
            currentAuthConfig
        ):
            iface.messageBar().pushCritical(
                "Trends.Earth", tr_auth.tr("Cannot update auth configuration")
            )
            return None
    QtCore.QSettings().setValue(
        f"trends_earth/{auth_setup.key}", currentAuthConfig.id()
    )
    return currentAuthConfig.id()