{"record":{"id":"0896cef0071203cd","repo":"AlexxIT/go2rtc","slug":"invalid-auth-type-for-email-authentication","errorCode":null,"errorMessage":"invalid auth type for email authentication","messagePattern":"invalid auth type for email authentication","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/ring/api.go","lineNumber":238,"sourceCode":"\treturn commandsAPIBaseURL + path\n}\n\nfunc AppAPI(path string) string {\n\treturn appAPIBaseURL + path\n}\n\nfunc (c *RingApi) GetAuth(twoFactorAuthCode string) (*AuthTokenResponse, error) {\n\tvar grantData map[string]string\n\n\tif c.authConfig != nil && twoFactorAuthCode == \"\" {\n\t\tgrantData = map[string]string{\n\t\t\t\"grant_type\":    \"refresh_token\",\n\t\t\t\"refresh_token\": c.authConfig.RT,\n\t\t}\n\t} else {\n\t\tauthEmail, ok := c.auth.(EmailAuth)\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid auth type for email authentication\")\n\t\t}\n\t\tgrantData = map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\":   authEmail.Email,\n\t\t\t\"password\":   authEmail.Password,\n\t\t}\n\t}\n\n\tgrantData[\"client_id\"] = \"ring_official_android\"\n\tgrantData[\"scope\"] = \"client\"\n\n\tbody, err := json.Marshal(grantData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal auth request: %w\", err)\n\t}\n\n\treq, err := http.NewRequest(\"POST\", oauthURL, bytes.NewReader(body))\n\tif err != nil {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/ring/api.go#L220-L256","documentation":"Type assertion guard in RingApi.GetAuth: email authentication with a 2FA code is requested, but the configured auth is not an EmailAuth value (e.g. refresh-token flow with an empty code). The auth config type is at fault.","triggerScenarios":"Thrown at pkg/ring/api.go:238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure EmailAuth credentials when authenticating with username/password","Provide a valid refresh token so the refresh flow is used instead of email auth"],"exampleFix":null,"handlingStrategy":"type-guard","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"}