{"record":{"id":"13f59f93354d86c6","repo":"ory/kratos","slug":"unsupported-auth-type-s","errorCode":null,"errorMessage":"unsupported auth type: %s","messagePattern":"unsupported auth type: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"request/auth.go","lineNumber":56,"sourceCode":"\t\tvalue, ok := config[\"value\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"api_key auth strategy requires a string value\")\n\t\t}\n\t\tin, _ := config[\"in\"].(string) // in is optional\n\t\treturn NewAPIKeyStrategy(in, name, value), nil\n\tcase \"basic_auth\":\n\t\tuser, ok := config[\"user\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"basic_auth auth strategy requires a string user\")\n\t\t}\n\t\tpassword, ok := config[\"password\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"basic_auth auth strategy requires a string password\")\n\t\t}\n\t\treturn NewBasicAuthStrategy(user, password), nil\n\t}\n\n\treturn nil, fmt.Errorf(\"unsupported auth type: %s\", typ)\n}\n\nfunc NewNoopAuthStrategy() AuthStrategy {\n\treturn &noopAuthStrategy{}\n}\n\nfunc (c *noopAuthStrategy) apply(_ *retryablehttp.Request) {}\n\nfunc NewBasicAuthStrategy(user, password string) AuthStrategy {\n\treturn &basicAuthStrategy{\n\t\tuser:     user,\n\t\tpassword: password,\n\t}\n}\n\nfunc (c *basicAuthStrategy) apply(req *retryablehttp.Request) {\n\treq.SetBasicAuth(c.user, c.password)\n}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/request/auth.go#L38-L74","documentation":"authStrategy switches on the auth \"type\" field and returns a strategy for \"\" (noop), \"api_key\", and \"basic_auth\". Any other type string reaches the fallthrough and produces this error, failing NewBuilder. Note the type must also be a string in the config map.","triggerScenarios":"Webhook auth config with type set to an unrecognized value such as \"bearer\", \"oauth2\", \"digest\", or a typo like \"apikey\" / \"basicauth\".","commonSituations":"Copying auth config from another webhook product that supports bearer tokens; typos in the type string; assuming OAuth is supported when it isn't in this version.","solutions":["Set type to one of: \"\" (no auth), \"api_key\", or \"basic_auth\"","Fix typos: \"apikey\" -> \"api_key\", \"basicauth\" -> \"basic_auth\"","Remove the auth block entirely if no authentication is needed","Check the library version's supported strategies — newer ones may add types"],"exampleFix":"// before\nauth:\n  type: bearer\n  token: abc\n// after\nauth:\n  type: api_key\n  in: header\n  name: Authorization\n  value: \"Bearer abc\"","handlingStrategy":"validation","validationCode":"// Go: check auth type against supported set before building\nvar supportedAuthTypes = map[string]bool{\"\": true, \"api_key\": true, \"basic_auth\": true}\nfunc validateAuthType(cfg map[string]interface{}) error {\n\ttyp, _ := cfg[\"type\"].(string)\n\tif !supportedAuthTypes[typ] {\n\t\treturn fmt.Errorf(\"unsupported auth type %q; use '', 'api_key', or 'basic_auth'\", typ)\n\t}\n\treturn nil\n}","typeGuard":"func isSupportedAuthType(cfg map[string]interface{}) bool {\n\ttyp, _ := cfg[\"type\"].(string)\n\treturn typ == \"\" || typ == \"api_key\" || typ == \"basic_auth\"\n}","tryCatchPattern":"b, err := request.NewBuilder(cfg)\nif err != nil {\n\tvar unsupportedErr interface{ Error() string }\n\tif strings.HasPrefix(err.Error(), \"unsupported auth type\") {\n\t\treturn fmt.Errorf(\"check auth.type spelling; supported: '', api_key, basic_auth\")\n\t}\n\treturn err\n}","preventionTips":["Validate auth.type against an enum in config linting","Remember bearer/OAuth are not built-in; emulate via api_key with an Authorization header","Don't write \"apikey\"/\"basicauth\" — underscores are required","Check release notes when upgrading for newly supported auth types"],"tags":["configuration","auth","unsupported"],"backgroundTag":"invalid-enum-value","analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}