fix(mf): utiliser header apikey: au lieu de Bearer (API Key longue durée)
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run

Le portail-api.meteofrance.fr utilise 2 mécanismes d auth différents :
- Token OAuth2 court (1h) → header Authorization: Bearer <token>
- API Key longue durée    → header apikey: <key>

On utilise la 2e, donc switch du header.

+ data-sources/Bulletin_Vigilance_swagger.json (gitignored mais utile en local
  pour préparer le switch Opendatasoft → Vigilance officielle Météo France).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Florian 2026-05-26 00:32:33 +02:00
parent a849977fcc
commit 5fbbec4902

View file

@ -17,11 +17,13 @@ export async function fetchMF(path: string, init: RequestInit = {}): Promise<Res
if (!key) {
throw new Error('METEOFRANCE_API_KEY missing in env');
}
// Le portail Météo France utilise le header `apikey:` pour les API Keys
// longue durée (différent du `Authorization: Bearer` des tokens OAuth2 courts).
return fetch(`${BASE}${path}`, {
...init,
headers: {
...init.headers,
Authorization: `Bearer ${key}`,
apikey: key,
Accept: 'application/json',
},
});