I am getting the same error. Although I'm not using REST API. I'm using Swift.
Based on a few other replies on other similar messages, we are not alone.
My code was working fine last night. Tried today after making a few changes and I keep getting error 401. I reverted my new changes and still get the error.
I have up-to-date provisioning profile and certificates, and have WeatherKit correctly integrated (as of yesterday at least).
I went back to Apple's FlightPlanner project and even that doesn't work anymore. I made a very stripped down weatherkit program and can't get that to work either.
Here's my error message from FlightPlanner in case others are experiencing it too. Apple, please help.
Some of the Output:
2023-03-14 20:46:35.082748-0700 FlightPlanner[12854:203691] [WeatherDataService] Received authentication failure for request: 37F8FBEC-E6B5-4124-B28F-F556A90061CE:1
2023-03-14 20:46:35.085862-0700 FlightPlanner[12854:203691] [WeatherService] Encountered an error when fetching weather data subset; location=<+37.62130000,-122.37900000> +/- 0.00m (speed -1.00 mps / course -1.00) @ 3/14/23, 8:46:33 PM Pacific Daylight Time, error=invalidAuthorization(<NSHTTPURLResponse: 0x600003cfa7e0> { URL: https://weather-data.apple.com/v3/weather/en/37.621/-122.379?timezone=America/Los_Angeles&dataSets=currentWeather&country=US } { Status Code: 401, Headers {
"Access-Control-Allow-Origin" = (
"*"
);
"Cache-Control" = (
"max-age=0, no-cache, no-store"
);
Connection = (
close
);
"Content-Security-Policy" = (
"default-src 'self';"
);
Date = (
"Wed, 15 Mar 2023 03:46:34 GMT"
);
Expires = (
"Wed, 15 Mar 2023 03:46:34 GMT"
);
Pragma = (
"no-cache"
);
Server = (
Apple
);
"Strict-Transport-Security" = (
"max-age=31536000; includeSubdomains"
);
"X-Cache" = (
"TCP_MISS from a104-123-67-38.deploy.akamaitechnologies.com (AkamaiGHost/11.0.2-47096334) (-)"
);
"X-Content-Type-Options" = (
nosniff
);
"X-Frame-Options" = (
SAMEORIGIN
);
"X-REQUEST-ID" = (
"e9e27d87-209a-4c26-9048-cb7250784b99"
);
"X-XSS-Protection" = (
"1; mode=block"
);
} })