Hello Hello,Since darksky will be remove in march 31 i am trying to merge to WeatherKit REST API. I followed all the instructions from the doc (create service ID -> weatherkit Key ...) I also created my JWT using those lines :
const options = {
“header” :
{
“alg” : “ES256”, //algorithm to use. Only work with E256
“kid” : KEY_ID,
“id” : `${TEAM_ID}.${APP_ID}`
}
}
const payload = {
“iss” : TEAM_ID,
“iat” : vrglobals.now(),
“exp” : vrglobals.now() + 3600,
“sub” : APP_ID,
}
const privateKey = fs.readFileSync(KEY_PATH);
const header = jwt.sign(payload,privateKey, options);
return header;
After that i tried to call the endpoints but ended with a 401 error ...
const _SparkHttp = new SparkHttp(‘https://weatherkit.apple.com/api/v1/weather/en/51.677612/-2.937941?dataSets=currentWeather&timezone=Europe/London’);
_SparkHttp.setHeaders({“Authorization” : `Bearer ${token}`});
const response = await _SparkHttp.get();
Do you have any idea on how to solve that ?