{"record":{"id":"f961395bbcbc4d53","repo":"kgretzky/evilginx2","slug":"auth-tokens-name-not-found-for-body-auth-token","errorCode":null,"errorMessage":"auth_tokens: 'name' not found for body auth token","messagePattern":"auth_tokens: 'name' not found for body auth token","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/phishlet.go","lineNumber":553,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'keys' not found for cookie auth token\")\n\t\t\t}\n\n\t\t\tfor n := range *at.Keys {\n\t\t\t\t(*at.Keys)[n] = p.paramVal((*at.Keys)[n])\n\t\t\t}\n\t\t\terr := p.addCookieAuthTokens(p.paramVal(*at.Domain), *at.Keys)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"body\":\n\t\t\tif at.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'domain' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Path == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'path' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Name == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'name' not found for body auth token\")\n\t\t\t}\n\t\t\tif at.Search == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'search' not found for body auth token\")\n\t\t\t}\n\n\t\t\terr := p.addBodyAuthToken(p.paramVal(*at.Domain), p.paramVal(*at.Path), p.paramVal(*at.Name), p.paramVal(*at.Search))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"http\":\n\t\t\tif at.Domain == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'domain' not found for http auth token\")\n\t\t\t}\n\t\t\tif at.Path == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'path' not found for http auth token\")\n\t\t\t}\n\t\t\tif at.Name == nil {\n\t\t\t\treturn fmt.Errorf(\"auth_tokens: 'name' not found for http auth token\")","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/kgretzky/evilginx2/blob/4c0988a1d9db4d172a185e979a38bfd0efdb5830/core/phishlet.go#L535-L571","documentation":"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.","triggerScenarios":"An auth_tokens entry with `type: body` contains `domain`, `path`, and `search` but no `name:` key.","commonSituations":"Deleting the name line while renaming the token; incomplete entry from a template; YAML indentation placing `name` in the wrong entry.","solutions":["Add a `name` field to the body auth token entry with an identifier for the token (e.g. `name: session_token`).","If a `search` field is also missing, supply it too — body tokens require domain, path, name, and search together.","Verify all four required body-token fields are children of the same auth_tokens list item."],"exampleFix":"// before (phishlet.yml)\nauth_tokens:\n  - type: body\n    domain: api\n    path: ^/api/login$\n    search: 'token=([A-Za-z0-9]+)'\n// after\nauth_tokens:\n  - type: body\n    domain: api\n    path: ^/api/login$\n    name: token\n    search: 'token=([A-Za-z0-9]+)'","handlingStrategy":"validation","validationCode":"for i, at := range cfg.AuthTokens {\n    if at.Type != nil && *at.Type == \"body\" && at.Name == nil {\n        return fmt.Errorf(\"auth_tokens[%d]: 'name' not found for body auth token\", i)\n    }\n}","typeGuard":"func bodyTokenComplete(at AuthToken) bool {\n    return at.Domain != nil && at.Path != nil && at.Name != nil && at.Search != nil\n}","tryCatchPattern":null,"preventionTips":["Author body token entries as a complete four-field block (domain, path, name, search).","Give tokens descriptive names matching the session variable they represent.","Run the phishlet loader in CI/tests to catch missing fields before deployment."],"tags":["phishlet","configuration","auth-tokens","yaml-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"4c0988a1d9db4d172a185e979a38bfd0efdb5830","analyzedAt":"2026-09-05T19:23:07.238Z","contentChangedAt":"2026-09-05T19:23:07.238Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}