Need help to validate a JWT Token in 4.0 Net Framework

Hi, i created an identity server 4 in net core. Now i need to validate the access Token into an old WCF web service in net 4.0. Many libraries are avaiable starting from framweork 4.5. i’m made some test with jose-jwt but cannot decode the token.

this is a sample token coming from the IdentityServer:

eyJhbGciOiJSUzI1NiIsImtpZCI6InVVaENEMWZtLUp4OGdIeDRZX2djM1EiLCJ0eXAiOiJhdCtqd3QifQ.eyJuYmYiOjE1OTMxNzc3NjQsImV4cCI6MTU5MzE4MTM2NCwiaXNzIjoiaHR0cDovL2lkZW50aXR5c2VydmVyLmRldi4yNG9yZXByby5pbi5pbHNvbGUyNG9yZS5pdCIsImF1ZCI6InN3Z19lbnRpdGxlbWVudHMiLCJjbGllbnRfaWQiOiJtdmMiLCJzdWIiOiJmZGIxIiwiYXV0aF90aW1lIjoxNTkzMTc3NzYzLCJpZHAiOiJsb2NhbCIsInJvbGUiOlsiZGF0YUV2ZW50UmVjb3Jkcy5hZG1pbiIsImRhdGFFdmVudFJlY29yZHMudXNlciJdLCJ1c2VybmFtZSI6ImZkYjEiLCJ1c2VySWRlbnRpdHkiOiJERmhmOHRMM1IxTzlFSm5SNG5hdFloVm1uY0pWRzhMaEFBVjRxeUEvWjVjPSIsInNjb3BlIjpbInByb2ZpbGUiLCJvcGVuaWQiLCJzd2dfZW50aXRsZW1lbnRzIiwib2ZmbGluZV9hY2Nlc3MiXSwiYW1yIjpbInB3ZCJdfQ.DrReWgy1Yy-HRDbfVexxmmM9VWML2bVargSVOTfwyBVryxV1mozpcsQjqbu91Epq5WnhXmddKN7vnlhp5U-eFxIycqr45jmBcFWQtwudUZudFGVvRvoNJD8GU24cI-8RWeQ9YiRY8d_sKpQv3cT_FNbvbDyhpEHoaF9tkADnrDrCSDfpDGRbM-oMeDJpLUEwoY2UH_Cs-v5UGf4-fjpwmqHPcbVBmGT7qJlLSh_Ac9gTdC1nIBq7GRDEwgUwurGdONxqGeVh_Jon3OWlrfeZIQu_o-7LOH1Lo5PRd6OtXYCxj4AOTpZ3wQ0hk-Emfmy1745F8TUnYEgpcrhLSQfPLg

on Jose.JWT.Decode(token) get the error:
System.ArgumentException: ‘RsaUsingSha alg expects key to be of AsymmetricAlgorithm type.’

how to fix the issue?

thanks.

1 Like

Hi @fabriziosw,

It looks like it is expecting a key param after token to verify the token signature.

Please let me know if this solves it.

yes, but i really don’t know from where to get that key.

I found another example that could help: