diff --git a/server/mdm/apple/apple_apps/api.go b/server/mdm/apple/apple_apps/api.go index 8cbe23e181..20b9293ce6 100644 --- a/server/mdm/apple/apple_apps/api.go +++ b/server/mdm/apple/apple_apps/api.go @@ -275,7 +275,7 @@ func GetAuthenticator(ctx context.Context, ds DataStore, licenseKey string) Auth } body, err := json.Marshal(struct { - ServerURL string `json:"serverUrl"` + ServerURL string `json:"fleetServerUrl"` }{appConfig.ServerSettings.ServerURL}) if err != nil { return "", ctxerr.Wrap(ctx, err, "encoding authentication request for VPP metadata service") diff --git a/server/mdm/apple/apple_apps/api_test.go b/server/mdm/apple/apple_apps/api_test.go index 276d0ba88a..d6114392b7 100644 --- a/server/mdm/apple/apple_apps/api_test.go +++ b/server/mdm/apple/apple_apps/api_test.go @@ -274,7 +274,7 @@ func TestAuthentication(t *testing.T) { // Verify the URL is set body, err := io.ReadAll(r.Body) require.NoError(t, err) - require.JSONEq(t, `{"serverUrl": "https://fleet.example.com"}`, string(body)) + require.JSONEq(t, `{"fleetServerUrl": "https://fleet.example.com"}`, string(body)) w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte(`{"fleetServerSecret": "new-token-from-auth"}`)) @@ -317,6 +317,7 @@ func TestAuthentication(t *testing.T) { // Set up a mock auth server authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { require.Equal(t, "Bearer my-license-key", r.Header.Get("Authorization")) + w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte(`{"fleetServerSecret": "fresh-token"}`)) }))