{"record":{"id":"980796b1397d2177","repo":"fatedier/frp","slug":"unsupported-auth-method-s","errorCode":null,"errorMessage":"unsupported auth method: %s","messagePattern":"unsupported auth method: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/auth/auth.go","lineNumber":78,"sourceCode":"\t\tkey:    []byte(resolved.Token),\n\t}, nil\n}\n\nfunc NewAuthSetter(cfg v1.AuthClientConfig) (authProvider Setter, err error) {\n\tswitch cfg.Method {\n\tcase v1.AuthMethodToken:\n\t\tauthProvider = NewTokenAuth(cfg.AdditionalScopes, cfg.Token)\n\tcase v1.AuthMethodOIDC:\n\t\tif cfg.OIDC.TokenSource != nil {\n\t\t\tauthProvider = NewOidcTokenSourceAuthSetter(cfg.AdditionalScopes, cfg.OIDC.TokenSource)\n\t\t} else {\n\t\t\tauthProvider, err = NewOidcAuthSetter(cfg.AdditionalScopes, cfg.OIDC)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported auth method: %s\", cfg.Method)\n\t}\n\treturn authProvider, nil\n}\n\ntype Verifier interface {\n\tVerifyLogin(*msg.Login) error\n\tVerifyPing(*msg.Ping) error\n\tVerifyNewWorkConn(*msg.NewWorkConn) error\n}\n\ntype ServerAuth struct {\n\tVerifier Verifier\n\tkey      []byte\n}\n\nfunc (a *ServerAuth) EncryptionKey() []byte {\n\treturn a.key\n}","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/auth/auth.go#L60-L96","documentation":"NewAuthSetter hit the default switch branch: the configured auth method string matches neither 'token' nor 'oidc', so no auth provider can be constructed. This is a strict config validation failure at startup before any networking happens.","triggerScenarios":"cfg.Method is an arbitrary or misspelled string (e.g., 'Token', 'tokens', empty) because upstream validation did not run or a custom code path bypassed it.","commonSituations":"Typo or wrong case in auth.method in the config file; programmatically built configs skipping validation before calling NewAuthSetter; version drift where a method valid in one release or fork is passed to another that doesn't know it.","solutions":["Set auth.method to exactly 'token' or 'oidc' (lowercase) per the v1 schema.","When building configs in code, run the validation layer before constructing auth so callers get a proper error message.","Check for stray whitespace or case differences in the config value."],"exampleFix":"# before (frpc.toml)\n[auth]\nmethod = \"Token\"\n\n# after\n[auth]\nmethod = \"token\"\ntoken = \"real-secret\"","handlingStrategy":"type-guard","validationCode":"switch cfg.Method {\ncase v1.AuthMethodToken, v1.AuthMethodOIDC:\ndefault:\n    return fmt.Errorf(\"auth.method must be token or oidc, got %q\", cfg.Method)\n}","typeGuard":"func isValidAuthMethod(m v1.AuthMethod) bool {\n    return m == v1.AuthMethodToken || m == v1.AuthMethodOIDC\n}","tryCatchPattern":null,"preventionTips":["Use the v1 constants instead of raw strings","Run config validation before auth construction","Lint configs for unknown enum values in CI"],"tags":["auth","config","validation"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}