AlexxIT/go2rtc · error

email, password, api_key and api_id required

Error message

email, password, api_key and api_id required

What it means

HTTP 400 sentinel from apiAuth: a required form field is empty — one of email, password, api_key, or api_id was not supplied in the request, so Wyze cloud login cannot be attempted.

Solutions

  1. Submit all four form fields: email, password, api_key, api_id
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/wyze/wyze.go:124 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/aa177690df78440e. Report an issue: GitHub.

Appendix: source

Thrown at internal/wyze/wyze.go:124

	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}

func apiAuth(w http.ResponseWriter, r *http.Request) {
	if err := r.ParseForm(); err != nil {
		http.Error(w, err.Error(), http.StatusBadRequest)
		return
	}

	email := r.Form.Get("email")
	password := r.Form.Get("password")
	apiKey := r.Form.Get("api_key")
	apiID := r.Form.Get("api_id")

	if email == "" || password == "" || apiKey == "" || apiID == "" {
		http.Error(w, "email, password, api_key and api_id required", http.StatusBadRequest)
		return
	}

	// Try to login
	cloud := wyze.NewCloud(apiKey, apiID)

	if err := cloud.Login(email, password); err != nil {
		// Check for MFA error
		var authErr *wyze.AuthError
		if ok := isAuthError(err, &authErr); ok {
			w.Header().Set("Content-Type", api.MimeJSON)
			w.WriteHeader(http.StatusUnauthorized)
			_ = json.NewEncoder(w).Encode(authErr)
			return
		}
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

View on GitHub (pinned to c245815e75)