argoproj/argo-workflows · error

error parsing basic authentication

Error message

error parsing basic authentication

What it means

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.

Source

Thrown at util/kubeconfig/kubeconfig.go:46

	rules := clientcmd.NewDefaultClientConfigLoadingRules()
	config := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(rules, &clientcmd.ConfigOverrides{})
	return config.ClientConfig()
}

func IsBasicAuthScheme(token string) bool {
	return strings.HasPrefix(token, BasicAuthScheme)
}

func IsBearerAuthScheme(token string) bool {
	return strings.HasPrefix(token, BearerAuthScheme)
}

func GetRestConfig(token string) (*restclient.Config, error) {
	if IsBasicAuthScheme(token) {
		token = strings.TrimSpace(strings.TrimPrefix(token, BasicAuthScheme))
		username, password, ok := decodeBasicAuthToken(token)
		if !ok {
			return nil, errors.New("error parsing basic authentication")
		}
		return GetBasicRestConfig(username, password)
	}
	if IsBearerAuthScheme(token) {
		token = strings.TrimSpace(strings.TrimPrefix(token, BearerAuthScheme))
		return GetBearerRestConfig(token)
	}
	return nil, errors.New("unsupported authentication scheme")
}

// GetBasicRestConfig converts a basic token (username, password) into a REST config.
func GetBasicRestConfig(username, password string) (*restclient.Config, error) {
	restConfig, err := restConfigWithoutAuth()
	if err != nil {
		return nil, err
	}
	restConfig.Username = username
	restConfig.Password = password

View on GitHub (pinned to 35bff19146)

Solutions

  1. Re-issue the request with a valid Authorization: Basic <base64(user:password)> header
  2. Use a Bearer token instead of basic auth
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at util/kubeconfig/kubeconfig.go:46 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/c7bd8ade3223fbd0. Report an issue: GitHub.