Add User-Agent header to Garmin API requests
All checks were successful
Deploy / deploy (push) Successful in 2m29s
All checks were successful
Deploy / deploy (push) Successful in 2m29s
Garmin now requires a mobile app User-Agent header (GCM-iOS-5.7.2.1) for API access. Without it, they serve the website HTML instead of JSON API responses. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -183,6 +183,7 @@ describe("fetchGarminData", () => {
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: "Bearer test-token",
|
Authorization: "Bearer test-token",
|
||||||
NK: "NT",
|
NK: "NT",
|
||||||
|
"User-Agent": "GCM-iOS-5.7.2.1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ export async function fetchGarminData(
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${options.oauth2Token}`,
|
Authorization: `Bearer ${options.oauth2Token}`,
|
||||||
NK: "NT",
|
NK: "NT",
|
||||||
|
"User-Agent": "GCM-iOS-5.7.2.1",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,6 +62,7 @@ export async function fetchHrvStatus(
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${oauth2Token}`,
|
Authorization: `Bearer ${oauth2Token}`,
|
||||||
NK: "NT",
|
NK: "NT",
|
||||||
|
"User-Agent": "GCM-iOS-5.7.2.1",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -116,6 +118,7 @@ export async function fetchBodyBattery(
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${oauth2Token}`,
|
Authorization: `Bearer ${oauth2Token}`,
|
||||||
NK: "NT",
|
NK: "NT",
|
||||||
|
"User-Agent": "GCM-iOS-5.7.2.1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -174,6 +177,7 @@ export async function fetchIntensityMinutes(
|
|||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${oauth2Token}`,
|
Authorization: `Bearer ${oauth2Token}`,
|
||||||
NK: "NT",
|
NK: "NT",
|
||||||
|
"User-Agent": "GCM-iOS-5.7.2.1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user