{"record":{"id":"689f078518e37518","repo":"siyuan-note/siyuan","slug":"unsupported-oidc-provider-s","errorCode":null,"errorMessage":"unsupported OIDC provider [%s]","messagePattern":"unsupported OIDC provider \\[(.+?)\\]","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/oidc_provider/provider.go","lineNumber":58,"sourceCode":"\t\treturn nil, errors.New(\"OIDC client ID is required\")\n\t}\n\tif redirectURL == \"\" {\n\t\treturn nil, errors.New(\"OIDC redirect URL is required\")\n\t}\n\tif config.Provider == conf.OIDCProviderGitHub && config.ClientSecret == \"\" {\n\t\treturn nil, errors.New(\"GitHub OAuth client secret is required\")\n\t}\n\tissuerURL := strings.TrimSpace(config.IssuerURL)\n\tswitch config.Provider {\n\tcase conf.OIDCProviderGoogle:\n\t\tissuerURL = googleIssuer\n\tcase conf.OIDCProviderMicrosoft:\n\t\t// Microsoft 多租户端点的 issuer 会随租户变化，必须使用租户专属 issuer。\n\tcase conf.OIDCProviderCustom:\n\tcase conf.OIDCProviderGitHub:\n\t\treturn newGitHub(config, redirectURL), nil\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported OIDC provider [%s]\", config.Provider)\n\t}\n\tif issuerURL == \"\" {\n\t\treturn nil, errors.New(\"OIDC issuer URL is required\")\n\t}\n\tdiscovered, err := oidc.NewProvider(ctx, issuerURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"discover OIDC provider failed: %w\", err)\n\t}\n\tscopes := append([]string{}, config.Scopes...)\n\tif !contains(scopes, oidc.ScopeOpenID) {\n\t\tscopes = append([]string{oidc.ScopeOpenID}, scopes...)\n\t}\n\treturn &Provider{\n\t\tkind: conf.OIDCProviderCustom,\n\t\toauth2Config: &oauth2.Config{\n\t\t\tClientID:     config.ClientID,\n\t\t\tClientSecret: config.ClientSecret,\n\t\t\tEndpoint:     discovered.Endpoint(),","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/oidc_provider/provider.go#L40-L76","documentation":"Thrown by oidc_provider.New() when config.Provider does not match any of the known constants: OIDCProviderGoogle, OIDCProviderMicrosoft, OIDCProviderCustom, or OIDCProviderGitHub. The switch's default case formats the unrecognized value into the error so the developer can see what was passed.","triggerScenarios":"Calling New() with config.Provider set to a value outside the four supported enum constants. This can happen if the conf.OIDCProvider type is a raw string/int and the admin or a config migration wrote an arbitrary value, or a new provider constant was added to conf but not yet handled in this switch.","commonSituations":"A typo in the configuration file (e.g., 'gitHub' instead of the expected constant value). A future version added a new provider constant but the switch in provider.go was not updated. The config was hand-edited to an invalid provider string.","solutions":["Set config.Provider to one of: OIDCProviderGoogle, OIDCProviderMicrosoft, OIDCProviderCustom, or OIDCProviderGitHub.","Check the raw config value for typos or case sensitivity issues.","If you added a new provider constant, add a case branch in the switch statement of New()."],"exampleFix":"// before\nconfig.Provider = \"git_hub\" // typo\n\n// after\nconfig.Provider = conf.OIDCProviderGitHub","handlingStrategy":"validation","validationCode":"validProviders := []string{conf.OIDCProviderGoogle, conf.OIDCProviderMicrosoft, conf.OIDCProviderCustom, conf.OIDCProviderGitHub}\nvalid := false\nfor _, p := range validProviders {\n    if config.Provider == p {\n        valid = true\n        break\n    }\n}\nif !valid {\n    return nil, fmt.Errorf(\"unsupported OIDC provider [%s]; use google, microsoft, custom, or github\", config.Provider)\n}","typeGuard":"func isValidOIDCProvider(p string) bool {\n    switch p {\n    case conf.OIDCProviderGoogle, conf.OIDCProviderMicrosoft, conf.OIDCProviderCustom, conf.OIDCProviderGitHub:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Use the defined constants (conf.OIDCProvider*) rather than raw strings.","Validate provider against the known set in the API handler before calling New().","When adding a new provider, add both the constant and the switch case simultaneously."],"tags":["oidc","authentication","config","enum","validation"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}