Which key to use to validate the Server-Side Notifications v2 JWTs?

I am looking at using the v2 in-app subscriptions server-side notifications. I have got this working by decoding and validating the token using the x5c and alg properties in the header.

However, I don't know how to validate that this certificate was issued by Apple. The docs don't really seem to say anything about this.

Does anyone know how I do this? At the moment, my code is a bit pointless as the jwt could have been signed by anyone.

The only other thing I can think of is to ignore the JWT altogether and just use the API to query every time which seems to defeat the object.

Please see this page with resources so you can verify its authenticity: https://www.apple.com/certificateauthority/

I am trying to implement this and it is not working. I don't know which certificate(s) I am supposed to use, and I'm having a hard time believing that there isn't some page of documentation we're all missing that properly addresses the intended best practices here.

For example: https://developer.apple.com/documentation/sign_in_with_apple/fetch_apple_s_public_key_for_verifying_token_signature Here it is much more clear what we are intended to do. I've actually implemented this and it works. I see other posts here and elsewhere on the internet on this same topic and in most cases, people aren't really sure what to do, and most of the answers are misunderstanding the basic issue. There are one or two who say they've gotten something working in Golang or something, but I wonder how reliable those solutions are.

  • Please provide better documentation on securing appstore server notifications (with the REST api this is less of an issue for obvious reasons)
  • Please provide a specific endpoint to fetch a public key for this, and document it clearly.
  • Please do not respond with a link to https://www.apple.com/certificateauthority/. That link is already available, I get the urge to save time by reusing an existing page as the solution for how to implement this new feature but it's not helpful.

Thanks

as always apple giving no shit about how developers can do shit

Which key to use to validate the Server-Side Notifications v2 JWTs?
 
 
Q