{"record":{"id":"e411054d9b316980","repo":"siyuan-note/siyuan","slug":"oidc-login-is-not-enabled","errorCode":null,"errorMessage":"OIDC login is not enabled","messagePattern":"OIDC login is not enabled","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/oidc.go","lineNumber":513,"sourceCode":"\tif err := c.ShouldBindJSON(input); err != nil || input.PollToken == \"\" {\n\t\tret.Code = -1\n\t\tret.Msg = oidcLanguage(369, \"Invalid OIDC configuration\")\n\t\treturn\n\t}\n\tworkspaceSession := util.GetWorkspaceSession(util.GetSession(c))\n\tif !cancelOIDCValidation(input.PollToken, workspaceSession.OIDCBinding) {\n\t\tret.Code = -1\n\t\tret.Msg = oidcLanguage(369, \"Invalid OIDC configuration\")\n\t}\n}\n\nfunc validateOIDCConfiguration() error {\n\treturn ValidateOIDCConfiguration(Conf.GetOIDC())\n}\n\nfunc ValidateOIDCConfiguration(config *conf.OIDC) error {\n\tif config == nil || !config.Enabled {\n\t\treturn errors.New(\"OIDC login is not enabled\")\n\t}\n\tif config.ClientID == \"\" {\n\t\treturn errors.New(\"OIDC client ID is required\")\n\t}\n\tif config.Provider == conf.OIDCProviderGitHub && config.ClientSecret == \"\" {\n\t\treturn errors.New(\"GitHub OAuth client secret is required\")\n\t}\n\tif (config.Provider == conf.OIDCProviderCustom || config.Provider == conf.OIDCProviderMicrosoft) && config.IssuerURL == \"\" {\n\t\treturn errors.New(\"OIDC issuer URL is required\")\n\t}\n\tif (config.Provider == conf.OIDCProviderCustom || config.Provider == conf.OIDCProviderMicrosoft) && config.IssuerURL != \"\" {\n\t\tissuer, err := url.Parse(config.IssuerURL)\n\t\tif err != nil || issuer.Host == \"\" || issuer.User != nil || issuer.RawQuery != \"\" || issuer.Fragment != \"\" ||\n\t\t\t(issuer.Scheme != \"https\" && !util.IsLocalHostname(issuer.Hostname())) {\n\t\t\treturn errors.New(\"OIDC issuer URL must use HTTPS unless it is a loopback address\")\n\t\t}\n\t}\n\tif config.Provider != conf.OIDCProviderCustom && config.Provider != conf.OIDCProviderGoogle &&","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/oidc.go#L495-L531","documentation":"First failure mode of ValidateOIDCConfiguration (kernel/model/oidc.go:513): the OIDC config block is nil or its Enabled field is false. Every OIDC login/validate flow starts here, so any OIDC API call against a disabled configuration fails immediately.","triggerScenarios":"Hitting /api/system/oidc/* (login, validate, start) when settings -> about -> OIDC login is off, or calling ValidateOIDCConfiguration programmatically before the user has enabled OIDC.","commonSituations":"User toggled OIDC off but clients still call login; admin testing endpoints before flipping Enabled=true; mobile/desktop login buttons shown when OIDC is disabled.","solutions":["Enable OIDC in settings (set system.conf OIDC.Enabled=true) and save before retrying.","If the call came from a client login flow, hide the OIDC button when the config says Enabled=false.","Confirm Conf.GetOIDC() is not returning nil due to a missing/migrated config block."],"exampleFix":"// before\nValidateOIDCConfiguration(conf.GetOIDC()) // Enabled=false -> error\n// after — gate the call on enabled state\ncfg := conf.GetOIDC()\nif cfg == nil || !cfg.Enabled {\n    return nil // OIDC not in use; skip validation\n}\nreturn ValidateOIDCConfiguration(cfg)","handlingStrategy":"validation","validationCode":"cfg := conf.GetOIDC()\nif cfg == nil || !cfg.Enabled {\n    return nil // not an error in the calling context — OIDC is off\n}\nreturn ValidateOIDCConfiguration(cfg)","typeGuard":"func oidcEnabled(c *conf.OIDC) bool { return c != nil && c.Enabled }","tryCatchPattern":null,"preventionTips":["Gate all OIDC UI on the Enabled flag from /api/system/getConf.","Treat 'OIDC login is not enabled' as a configuration issue, not a retry candidate."],"tags":["oidc","auth","config","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}