{"record":{"id":"f6242286aad53652","repo":"juanfont/headscale","slug":"auth-request-rejected","errorCode":null,"errorMessage":"auth request rejected","messagePattern":"auth request rejected","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hscontrol/api/v1/auth.go","lineNumber":19,"sourceCode":"package apiv1\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"net/http\"\n\n\t\"github.com/danielgtaylor/huma/v2\"\n\t\"github.com/juanfont/headscale/hscontrol/types\"\n\t\"github.com/juanfont/headscale/hscontrol/util\"\n)\n\nfunc init() {\n\tregistrations = append(registrations, registerAuth)\n}\n\n// errAuthRejected is the verdict handed to the waiting registration flow when\n// an auth session is rejected.\nvar errAuthRejected = errors.New(\"auth request rejected\")\n\n// AuthRegisterRequestBody is the v1.AuthRegisterRequest body.\ntype AuthRegisterRequestBody struct {\n\tUser   string `json:\"user,omitempty\"`\n\tAuthID string `json:\"authId,omitempty\"`\n}\n\n// AuthApproveRequestBody is the v1.AuthApproveRequest body.\ntype AuthApproveRequestBody struct {\n\tAuthID string `json:\"authId,omitempty\"`\n}\n\n// AuthRejectRequestBody is the v1.AuthRejectRequest body.\ntype AuthRejectRequestBody struct {\n\tAuthID string `json:\"authId,omitempty\"`\n}\n\ntype (","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/api/v1/auth.go#L1-L37","documentation":"Wrapped error from doLoginURLWithClient when resp.Location() fails on a 3xx response. Location() errors when the Location header exists but cannot be parsed as a URL, or (per stdlib) when there are multiple Location headers. Note the body is still returned alongside the error.","triggerScenarios":"A 3xx response whose Location header is malformed (unparseable URL) — e.g. a misconfigured OIDC issuer_url or server_url producing a broken redirect target.","commonSituations":"Wrong server_url / issuer base URL configuration in headscale or the OIDC provider (missing scheme, bad characters), or a test stub returning a relative/malformed Location.","solutions":["Log the raw Location header and fix the configuration producing it (headscale server_url, OIDC issuer).","If using a custom/mock OIDC provider in tests, make it emit an absolute, well-formed Location.","Use the returned body in the error handler for diagnostics."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if resp.StatusCode >= 300 && resp.StatusCode < 400 {\n    if loc := resp.Header.Get(\"Location\"); loc != \"\" {\n        if _, err := url.Parse(loc); err != nil {\n            return fmt.Errorf(\"malformed Location %q: %w\", loc, err)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate issuer_url and server_url configs are absolute well-formed URLs.","Use the returned body for diagnostics when this error fires."],"tags":["integration","http","redirect","oidc","config"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}