siyuan-note/siyuan · error

Unsupported OIDC provider

Error message

Unsupported OIDC provider

What it means

Sixth check in ValidateOIDCConfiguration (kernel/model/oidc.go:533): the Provider field is not one of Custom, Google, Microsoft, or GitHub. This guards against typos and unknown enum values saved into the config (e.g. an integer that does not map to a supported provider).

Source

Thrown at kernel/model/oidc.go:533

	if config.ClientID == "" {
		return errors.New("OIDC client ID is required")
	}
	if config.Provider == conf.OIDCProviderGitHub && config.ClientSecret == "" {
		return errors.New("GitHub OAuth client secret is required")
	}
	if (config.Provider == conf.OIDCProviderCustom || config.Provider == conf.OIDCProviderMicrosoft) && config.IssuerURL == "" {
		return errors.New("OIDC issuer URL is required")
	}
	if (config.Provider == conf.OIDCProviderCustom || config.Provider == conf.OIDCProviderMicrosoft) && config.IssuerURL != "" {
		issuer, err := url.Parse(config.IssuerURL)
		if err != nil || issuer.Host == "" || issuer.User != nil || issuer.RawQuery != "" || issuer.Fragment != "" ||
			(issuer.Scheme != "https" && !util.IsLocalHostname(issuer.Hostname())) {
			return errors.New("OIDC issuer URL must use HTTPS unless it is a loopback address")
		}
	}
	if config.Provider != conf.OIDCProviderCustom && config.Provider != conf.OIDCProviderGoogle &&
		config.Provider != conf.OIDCProviderMicrosoft && config.Provider != conf.OIDCProviderGitHub {
		return errors.New("Unsupported OIDC provider")
	}
	if !config.AllowAll && len(config.ClaimRules) == 0 {
		return errors.New("OIDC login requires at least one claim rule when Allow all users is disabled")
	}
	for _, rule := range config.ClaimRules {
		if rule == nil || rule.Claim == "" || len(rule.Values) == 0 {
			return errors.New("OIDC claim rules must include a claim and at least one value")
		}
		if rule.Operator != conf.OIDCClaimOperatorEquals && rule.Operator != conf.OIDCClaimOperatorContains {
			return errors.New("Unsupported OIDC claim rule operator")
		}
		for _, value := range rule.Values {
			if value == "" {
				return errors.New("OIDC claim rule values cannot be empty")
			}
		}
	}
	return nil

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Pick one of GitHub, Google, Microsoft, or Custom from the settings UI and re-save.
  2. If editing JSON, use the exact conf.OIDCProvider* constant value.
  3. After fixing, re-run ValidateOIDCConfiguration to confirm all downstream checks pass.

Example fix

// before
cfg.Provider = 99 // unknown
// after
cfg.Provider = conf.OIDCProviderGitHub // one of the four supported constants
Defensive patterns

Strategy: validation

Validate before calling

switch cfg.Provider {
case conf.OIDCProviderCustom, conf.OIDCProviderGoogle,
     conf.OIDCProviderMicrosoft, conf.OIDCProviderGitHub:
    // ok
default:
    return errors.New("unsupported OIDC provider")
}

Type guard

func supportedProvider(p conf.OIDCProvider) bool {
    switch p {
    case conf.OIDCProviderCustom, conf.OIDCProviderGoogle,
         conf.OIDCProviderMicrosoft, conf.OIDCProviderGitHub:
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Saving an OIDC config whose Provider was set to an out-of-range constant, a string, or an integer outside the four supported values; typically from hand-edited JSON or a future-version downgrade.

Common situations: Editing conf.json directly with a wrong provider code; restoring a config from a different SiYuan version; a bug in a plugin that writes the OIDC block.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/98fe778fff5b84ca. Report an issue: GitHub.