gginter
gginter

Reputation: 71

Apple JWT generation on C#

I started using Apple Maps and I'm having issues initializing MapKit JS.

I've followed all documentation and video instructions to create the JWT tokens correctly, and after debugging the tokens with a few tools, they do seem to be right, but I still get the following browser level error when calling the method "mapkit.init: initialization failed because the authorization token is invalid".

My server side code is in .Net C#, and you can find the code I use to generate my tokens here https://dotnetfiddle.net/ZOfw8l (I modified it to replace the sensitive data). I'm using the "jose-jwt" nuget package, recommended by https://jwt.io/.

The header and payload seem to be fine so the problem must be on the signature, but after validating, I can confirm that the signature is valid.

Any idea what I'm doing wrong?

Thanks

Upvotes: 4

Views: 1598

Answers (1)

gginter
gginter

Reputation: 71

It turns out, Apple developer console was the problem, after deleting my Keys and Map IDs and recreate them, it worked fine.

So I leave this question here and code in case people wants a resource on how to easily create JWT with C# for Apple Maps or other platorm

Upvotes: 3

Related Questions