简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM