{"record":{"id":"c7bd8ade3223fbd0","repo":"argoproj/argo-workflows","slug":"error-parsing-basic-authentication","errorCode":null,"errorMessage":"error parsing basic authentication","messagePattern":"error parsing basic authentication","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/kubeconfig/kubeconfig.go","lineNumber":46,"sourceCode":"\trules := clientcmd.NewDefaultClientConfigLoadingRules()\n\tconfig := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, &clientcmd.ConfigOverrides{})\n\treturn config.ClientConfig()\n}\n\nfunc IsBasicAuthScheme(token string) bool {\n\treturn strings.HasPrefix(token, BasicAuthScheme)\n}\n\nfunc IsBearerAuthScheme(token string) bool {\n\treturn strings.HasPrefix(token, BearerAuthScheme)\n}\n\nfunc GetRestConfig(token string) (*restclient.Config, error) {\n\tif IsBasicAuthScheme(token) {\n\t\ttoken = strings.TrimSpace(strings.TrimPrefix(token, BasicAuthScheme))\n\t\tusername, password, ok := decodeBasicAuthToken(token)\n\t\tif !ok {\n\t\t\treturn nil, errors.New(\"error parsing basic authentication\")\n\t\t}\n\t\treturn GetBasicRestConfig(username, password)\n\t}\n\tif IsBearerAuthScheme(token) {\n\t\ttoken = strings.TrimSpace(strings.TrimPrefix(token, BearerAuthScheme))\n\t\treturn GetBearerRestConfig(token)\n\t}\n\treturn nil, errors.New(\"unsupported authentication scheme\")\n}\n\n// GetBasicRestConfig converts a basic token (username, password) into a REST config.\nfunc GetBasicRestConfig(username, password string) (*restclient.Config, error) {\n\trestConfig, err := restConfigWithoutAuth()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trestConfig.Username = username\n\trestConfig.Password = password","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/util/kubeconfig/kubeconfig.go#L28-L64","documentation":"GetRestConfig could not decode the base64 user:password pair from a Basic-authorization token. The token had the Basic scheme prefix but decodeBasicAuthToken failed to split/decode it, so no rest.Config can be built.","triggerScenarios":"Thrown at util/kubeconfig/kubeconfig.go:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-issue the request with a valid Authorization: Basic <base64(user:password)> header","Use a Bearer token instead of basic auth"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}