Post

Replies

Boosts

Views

Activity

Reply to WeatherKit REST API: missing properties
If I may piggyback on this thread because of its relevance, is there any chance that one field (that exists in DarkSky) be added to WeatherKit's WeatherAlerts? DarkSky's alerts include a string containing a detailed description of each specific alert. Weatherkit, on the other hand, includes only a URL for further details -- and there doesn't seem to be a programmatic way of scraping the contents of that URL for the text. A full detail text would be far more useful.
Aug ’22
Reply to Help with connecting to WeatherKit REST API (Java)
In light of the "Invalid signature" result from jwt.io as mentioned above, here is how I'm generating the private key (the .p8 file is in an /assets directory, with its headers stripped) AssetManager assetManager = this.getAssets(); InputStream stream = assetManager.open("PRIVATE_KEY_FILE.p8"); byte[] bytes = new byte[stream.available()]; int bytesRead = stream.read(bytes); // equals 200 byte[] pkcs8EncodedKey = new byte[0]; pkcs8EncodedKey = Base64.getDecoder().decode(bytes); KeyFactory factory = KeyFactory.getInstance("EC"); PrivateKey privateKey = factory.generatePrivate(new PKCS8EncodedKeySpec(pkcs8EncodedKey));
Jul ’22
Reply to Help with connecting to WeatherKit REST API (Java)
Per a suggestion, I decoded the resulting token using https://jwt.io/ and received the following: HEADER: { "alg": "ES256", "kid": "CXXXXXXXXX", "id": "QXXXXXXXXX.com.mycompany.myproject" } PAYLOAD: { "sub": "com.mycompany.myproject", "jti": "QXXXXXXXXX.com.mycompany.myproject", "iat": 1658508182203, "exp": 1658508212203, "iss": "QXXXXXXXXX" } VERIFY SIGNATURE: Invalid signature (Note, in both this and the original post, I've obfuscated the Apple-issued Team ID and Service ID)
Jul ’22