goharbor/harbor · error
auth mode: is not OIDC based
Error message
auth mode: %s is not OIDC based
What it means
Precondition failure in OIDCController.Prepare: the system auth mode is not OIDC-based, so OIDC login/callback endpoints are only valid when OIDC auth is enabled and the request is rejected with 412.
Solutions
- Configure Harbor's auth mode to oidc_auth before using OIDC login
- Verify the auth mode value saved in configuration
- Use the correct login flow for the active auth mode
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/core/controllers/oidc.go:62 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16).
Data as JSON: /api/errors/bf29364c8dd53239.
Report an issue: GitHub.
Appendix: source
Thrown at src/core/controllers/oidc.go:62
const userInfoKey = "oidc_user_info"
const redirectURLKey = "oidc_redirect_url"
const oidcUserComment = "Onboarded via OIDC provider"
const loginUserOperation = "login_user"
// OIDCController handles requests for OIDC login, callback and user onboard
type OIDCController struct {
api.BaseController
}
type onboardReq struct {
Username string `json:"username"`
}
// Prepare include public code path for call request handler of OIDCController
func (oc *OIDCController) Prepare() {
if mode, _ := config.AuthMode(oc.Context()); mode != common.OIDCAuth {
oc.SendPreconditionFailedError(fmt.Errorf("auth mode: %s is not OIDC based", mode))
return
}
}
// RedirectLogin redirect user's browser to OIDC provider's login page
func (oc *OIDCController) RedirectLogin() {
state := utils.GenerateRandomString()
pkceCode, err := pkce.Generate()
if err != nil {
log.Errorf("failed to generate PKCE code, error: %v", err)
oc.SendInternalServerError(err)
return
}
url, err := oidc.AuthCodeURL(oc.Context(), state, pkceCode)
if err != nil {
oc.SendInternalServerError(err)
return
}View on GitHub (pinned to 7b2fd08cc5)