kgretzky/evilginx2 · error

auth_tokens: 'domain' not found for cookie auth token

Error message

auth_tokens: 'domain' not found for cookie auth token

What it means

This error is thrown when a `cookie`-type entry in a phishlet's `auth_tokens` section does not define the required `domain` field. Cookie auth tokens need a domain to scope the token to; without it the entry cannot be registered. The phishlet is rejected at load time.

Source

Thrown at core/phishlet.go:532

			}
			err = p.addIntercept(*ic.Domain, path_re, *ic.HttpStatus, body, mime)
			if err != nil {
				return err
			}
		}
	}
	for _, at := range *fp.AuthTokens {
		ttype := "cookie"
		if at.Type != nil {
			ttype = *at.Type
		}
		if !stringExists(ttype, AUTH_TOKEN_TYPES) {
			return fmt.Errorf("auth_tokens: invalid token type: %s", ttype)
		}
		switch ttype {
		case "cookie":
			if at.Domain == nil {
				return fmt.Errorf("auth_tokens: 'domain' not found for cookie auth token")
			}
			if at.Keys == nil {
				return fmt.Errorf("auth_tokens: 'keys' not found for cookie auth token")
			}

			for n := range *at.Keys {
				(*at.Keys)[n] = p.paramVal((*at.Keys)[n])
			}
			err := p.addCookieAuthTokens(p.paramVal(*at.Domain), *at.Keys)
			if err != nil {
				return err
			}
		case "body":
			if at.Domain == nil {
				return fmt.Errorf("auth_tokens: 'domain' not found for body auth token")
			}
			if at.Path == nil {
				return fmt.Errorf("auth_tokens: 'path' not found for body auth token")

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Add a `domain` field to the cookie auth token entry, matching a subdomain declared in the phishlet (e.g. `domain: accounts`).
  2. If the token applies to all subdomains, check whether the format allows a wildcard domain and use it explicitly.
  3. Verify YAML list indentation so `domain` belongs to the same auth_tokens item as the `keys` list.

Example fix

// before (phishlet.yml)
auth_tokens:
  - keys: [auth_session]
// after
auth_tokens:
  - type: cookie
    domain: accounts
    keys: [auth_session]
Defensive patterns

Strategy: validation

Validate before calling

for i, at := range cfg.AuthTokens {
    if at.Type != nil && *at.Type == "cookie" && at.Domain == nil {
        return fmt.Errorf("auth_tokens[%d]: 'domain' not found for cookie auth token", i)
    }
}

Type guard

func cookieTokenComplete(at AuthToken) bool {
    return at.Domain != nil && at.Keys != nil && len(*at.Keys) > 0
}

Prevention

When it happens

Trigger: An auth_tokens entry with `type: cookie` (or no type, since cookie is the default) lists `keys:` but omits the `domain:` key entirely.

Common situations: Writing a minimal auth_tokens entry and forgetting domain; assuming domain is inherited from the phishlet host and skipping it; YAML indentation mistakes placing `domain` in the wrong entry.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of kgretzky/evilginx2@4c0988a1d9 (2026-09-05). Data as JSON: /api/errors/bdbf9e0ad965ba31. Report an issue: GitHub.