{"record":{"id":"670c327ed6ad2c95","repo":"AlexxIT/go2rtc","slug":"milesone-token-not-found-in-the-response","errorCode":null,"errorMessage":"milesone: token not found in the response","messagePattern":"milesone: token not found in the response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/webrtc/milestone.go","lineNumber":64,"sourceCode":"\t// support httpx protocol\n\tres, err := tcp.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn errors.New(\"milesone: authentication failed: \" + res.Status)\n\t}\n\n\tvar payload map[string]interface{}\n\tif err = json.NewDecoder(res.Body).Decode(&payload); err != nil {\n\t\treturn err\n\t}\n\n\ttoken, ok := payload[\"access_token\"].(string)\n\tif !ok {\n\t\treturn errors.New(\"milesone: token not found in the response\")\n\t}\n\n\tm.token = token\n\n\treturn nil\n}\n\nfunc parseFloat(s string) float64 {\n\tif s == \"\" {\n\t\treturn 0\n\t}\n\tf, _ := strconv.ParseFloat(s, 64)\n\treturn f\n}\n\nfunc (m *milestoneAPI) GetOffer() (string, error) {\n\trequest := struct {\n\t\tCameraId         string `json:\"cameraId\"`","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/webrtc/milestone.go#L46-L82","documentation":"Milestone GetToken's response-shape guard: the token endpoint returned HTTP 200 and the body decoded as JSON, but the 'access_token' field is absent or not a string. The server did not deliver a usable bearer token, so authentication cannot proceed.","triggerScenarios":"Thrown at internal/webrtc/milestone.go:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the raw payload to see what the server actually returned (often an HTML error page with 200)","Verify Milestone credentials and that the user has WebRTC permissions","Check for API version mismatches on the Milestone XProtect deployment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}