.netxamarin.iosxamarin.androidjwtthinktecture-ident-model

How to decode JWT in PCL that's compatible with Xamarin Android


I have a Xamarin.Forms solution with a PCL assembly, Android application and iOS application, and I want to decode a JWT in the PCL.

I can't use Thinktecture.IdentityModel.Core 1.1.0 or System.IdentityModel.Tokens.Jwt 4.0.0 or JWT 1.3.2 because none of them can be added to a project that targets 'portable-net45+win+MonoAndroid10+MonoTouch10'.

I was able to add Jose JWT 1.7.0 from NuGet and verify that it works in Unit Tests, but it causes me to get the following build error in my Xamarin Android project...

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Perhaps it doesn't exist in the Mono for Android profile?

Suggestions?


Solution

  • As you can see from http://developer.xamarin.com/guides/android/under_the_hood/assemblies/ the .NET framework in Mono for Android doesn't seem to contain the assembly System.Web.Extensions

    Edit: this means that you are referencing a library that was created for desktop use, and has not been recompiled with the Android reference assemblies. This is not supported.