kgretzky/evilginx2 · error

auth_tokens: 'name' not found for body auth token

Error message

auth_tokens: 'name' not found for body auth token

What it means

This error is thrown when a `body`-type entry in a phishlet's `auth_tokens` section defines `domain` and `path` but omits the required `name` field. The name identifies the extracted token variable; without it the captured value cannot be referenced. The phishlet is rejected at load time.

Source

Thrown at core/phishlet.go:553

				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")
			}
			if at.Name == nil {
				return fmt.Errorf("auth_tokens: 'name' not found for body auth token")
			}
			if at.Search == nil {
				return fmt.Errorf("auth_tokens: 'search' not found for body auth token")
			}

			err := p.addBodyAuthToken(p.paramVal(*at.Domain), p.paramVal(*at.Path), p.paramVal(*at.Name), p.paramVal(*at.Search))
			if err != nil {
				return err
			}
		case "http":
			if at.Domain == nil {
				return fmt.Errorf("auth_tokens: 'domain' not found for http auth token")
			}
			if at.Path == nil {
				return fmt.Errorf("auth_tokens: 'path' not found for http auth token")
			}
			if at.Name == nil {
				return fmt.Errorf("auth_tokens: 'name' not found for http auth token")

View on GitHub (pinned to 4c0988a1d9)

Solutions

  1. Add a `name` field to the body auth token entry with an identifier for the token (e.g. `name: session_token`).
  2. If a `search` field is also missing, supply it too — body tokens require domain, path, name, and search together.
  3. Verify all four required body-token fields are children of the same auth_tokens list item.

Example fix

// before (phishlet.yml)
auth_tokens:
  - type: body
    domain: api
    path: ^/api/login$
    search: 'token=([A-Za-z0-9]+)'
// after
auth_tokens:
  - type: body
    domain: api
    path: ^/api/login$
    name: token
    search: 'token=([A-Za-z0-9]+)'
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func bodyTokenComplete(at AuthToken) bool {
    return at.Domain != nil && at.Path != nil && at.Name != nil && at.Search != nil
}

Prevention

When it happens

Trigger: An auth_tokens entry with `type: body` contains `domain`, `path`, and `search` but no `name:` key.

Common situations: Deleting the name line while renaming the token; incomplete entry from a template; YAML indentation placing `name` 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/f961395bbcbc4d53. Report an issue: GitHub.