210
Views
42
Comments
[JWT] Error with latest version
Question
jwt
Service icon
Forge asset by João Almeida
Application Type
Service
Platform Version
11.18.1 (Build 38276)

Hello,

When trying the new version I got this error when reading a token.

I was working correctly before

Could not load type 'Microsoft.IdentityModel.Tokens.TokenHandler' from assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.


   at OutSystems.NssJWT_Core.CssJWT_Core.MssReadToken(String ssEncodedToken, Boolean ssVerifySignature, String ssSignatureKey, String ssSignatureKeyId, Boolean ssVerifyLifetime, Boolean ssVerifyIssuer, String ssIssuer, Boolean ssVerifyAudience, String ssAudience, Boolean ssShowDebugInformation, String& ssPlainToken, RCTokenHeaderRecord& ssTokenHeader, RCTokenPayloadRecord& ssTokenPayload, Boolean& ssHasValidToken, String& ssResultMessage)
   at ssJWT.RssExtensionJWT_Core.MssReadToken(HeContext heContext, String inParamEncodedToken, Boolean inParamVerifySignature, String inParamSignatureKey, String inParamSignatureKeyId, Boolean inParamVerifyLifetime, Boolean inParamVerifyIssuer, String inParamIssuer, Boolean inParamVerifyAudience, String inParamAudience, Boolean inParamShowDebugInformation, String& outParamPlainToken, IRecord& outParamTokenHeader, IRecord& outParamTokenPayload, Boolean& outParamHasValidToken, String& outParamResultMessage) 

We are on Version 11.18.1 (Build 37828).

Did I miss something ?


Kind regards

Luc

2022-02-18 15-32-27
João Almeida
Champion

Looks like some kind of dependency issue. I'll check if the extension was not packed properly. Are on Cloud or In Premises?

UserImage.jpg
Luc Lafontaine

on cloud

2022-02-18 15-32-27
João Almeida
Champion

Is that the full stack trace? Have you updated all dependencies? is the Demo working for you?

UserImage.jpg
Luc Lafontaine

hell Joao,

it seems that when installing from forge only the module jwt is loaded and not the module jwt_core is not replaced.

Do i need to upload myself the application ? 

The capture show the latest installation from forge. it keeps the old jwt_code unchanged

2022-02-18 15-32-27
João Almeida
Champion

Weird... No, you shouldn't need to load anything separately. Is the JWT_Core component running the lates version? It might have uploaded the latest but still be using a previous one.


If nothing else works, can you try to deploy manually the JWT_Core extension bundled?

2021-10-09 07-57-44
Stefan Weber
 
MVP

could be a dll location issue. Are you using server (not service) actions from JWT in multiple projects? If so you should try to republish all dependant applications once more from service center.

When using server actions the depending module and its assemblies become part of the target solution and if OutSystems is looking then for an assembly it could be that it just looks in the wrong path.

Stefan

UserImage.jpg
Luc Lafontaine

Thanks Stefan and Joao


yes we are using service actions in multiples modules 

I ll try this morning 

2022-02-18 15-32-27
João Almeida
Champion

Cool. If possible, let us know the result.

UserImage.jpg
Luc Lafontaine

I do not understand.. the JWT_Core does not seem to be the good one in studio but in center i see the latest upload version .. 

Service Center After Loading new version JWT_Core.PNG
Service Studio After Loading new version.PNG
ServiceCenter After Loading new version JWT.PNG
2022-02-18 15-32-27
João Almeida
Champion

Those screenshots don't really help, this seems to be a dependencies issue so are there any outdated dependencies?

  • have you republished the consumer modules?
  • is the Demo app working?

I just tested a scenario where I upgraded a personal area with a much older version of the component, upgraded it normally in Service Studio, and tested trying to create and read tokens, both with symmetric and asymmetric keys in the Demo App. All worked ok.


UserImage.jpg
Luc Lafontaine

of course I republished after refreshing the dependencies the consumer app :-) 

2021-10-09 07-57-44
Stefan Weber
 
MVP

Just to clarify my own post above. If you are only consuming via Service Actions then a republish von consuming applications shouldn't be necessary. At least not when it comes to the dll location retrieval problem i mentioned. In this case the assemblies only exist once.

Iam sorry that i cannot dig deeper into the problem to assist you. Iam using a previous, but customized solution of JWT in my own environments.

UserImage.jpg
Tiago Sousa

Any clue, or solution yet?

I'm having the same issue.

2022-02-18 15-32-27
João Almeida
Champion

Not really. Is the demo working for you?

2022-02-18 15-32-27
João Almeida
Champion

The Demo app, that can be installed along side the component. It's also available in Service Studio when searching the Forge.


UserImage.jpg
Luc Lafontaine

Hello,

I made another try. I went into service center to delete the service/lib modules and then reinstalled the latest versions. I have try the lastest demo. It is not working. Same issue.

Kind regards

Luc

2022-02-18 15-32-27
João Almeida
Champion

Could it be another component that's bundling Microsoft.IdentityModel 5.2.2? What version of JWT did you have before upgrading?

UserImage.jpg
Luc Lafontaine



2022-02-18 15-32-27
João Almeida
Champion

Sorry, but that print screen doesn't tell anything on which versions where installed...

UserImage.jpg
Luc Lafontaine

is not the last column of the screenshot ? 

  • Service Studio version
  • Integration Studion Version

  • if not tell me where to find it ? 
2022-02-18 15-32-27
João Almeida
Champion


Nope, the last columns are the Service Studio and Integration Studio versions.

Where you running the last version of JWT prior to this? If so it was the 4.0.6 version of the component.

2021-02-15 16-02-25
Steven de Jong

We are expierencing the same issue. After updating the Forge component (from version 4.0.6 to 4.0.7) and refreshing/republishing all consumers, we get the following error messages in the Error Log when validating an incoming Bearer token:

  • Could not load type 'Microsoft.IdentityModel.Tokens.TokenHandler' from assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
       at OutSystems.NssJWT_Core.CssJWT_Core.MssReadToken
       at ssJWT.RssExtensionJWT_Core.MssReadToken

  • Could not load type 'Microsoft.IdentityModel.Tokens.TokenHandler' from assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
       at ssJWT.RssExtensionJWT_Core.MssReadToken
       at ssJWT.Actions.ActionReadToken
       at ssJWT.Actions.ActionReadTokenWithoutValidation
2022-02-18 15-32-27
João Almeida
Champion

Ok, this definitely is some kind of "dependency hell" issue that I'm not being able to replicate, specially because version 4.0.6 depends on Microsoft.IdentityModel.Tokens 5.2.4.0 not 5.2.2.0.


For now, I'm going to mark this version as "In Development" because of this, specially until we're able to replicate or identify why it's happening. 

Meanwhile, if you can share which Plaform version currently running, that could give a hint on what could be the cause.

2021-02-15 16-02-25
Steven de Jong

Hi João,

Thanks for your quick reply. I was just thinking to mention the platform server version as well :)

We are currently using platform version 11.18.1

I read in the platform release notes that version 11.19 has a new way to choose which version of a DLL is used in case multiple extensions contain different versions of the same DLL.

A few weeks from now, we will upgrade to a newer platform version. I'm curious to see if that resolves the issue. If you are already on a newer platform version, that might be the reason why you can't replicate the issue.

(I wonder what platform version Luc Lafontaine is using?)

UserImage.jpg
Luc Lafontaine
UserImage.jpg
Luc Lafontaine

Hello,

The plateforme has been updated to Version 11.25.0 (Build 41743) 

I re-installed the latest version 4.0.6 and the demo. 

it is working fine so far.

Kind regards

Luc

2021-02-15 16-02-25
Steven de Jong

Hi João,

We upgraded our platform version to the latest 11.25.0 and now version 4.0.7 seems to work just fine.

I'd say it's safe to no longer mark 4.0.7 as "In Development"

I'm not sure if you can mark it as "requires platform version 11.19.0 or higher"?

2022-02-18 15-32-27
João Almeida
Champion

Uploading a new version with the updated libraries

2025-08-09 07-22-56
Bharathi Selvaraj

Facing the same issue with latest version .Any solutions ?

2022-02-18 15-32-27
João Almeida
Champion

As a temporary workaround, how about using this other component? Is the behavior the same?
https://www.outsystems.com/forge/component-overview/18736/jwt-secure-o11

It's the same component as this one, forked to have updated libraries. We're already in the process of merging that and other JWT related components. The features and interface are the same, so there should be no breaking changes, but the updated libraries might not have the same behavior.

2024-01-23 10-16-31
Munjal Subodh

I have the same issue. The forked component mentioned above (https://www.outsystems.com/forge/component-overview/18736/jwt-secure-o11) does not seem to exist on the Forge.

Any update on this?

I also tried the demo and that does not work either.

Here is some description from the error log:

Message: Could not load type 'Microsoft.IdentityModel.Tokens.TokenHandler' from assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 

Environment Information: 

eSpaceVer: Id=69324, PubId=0, CompiledWith=11.18.1.37828RequestUrl: https://appdev.skillibrium.com/Munjal_Sandbox/screenservices/Munjal_Sandbox/ClientSideCache/JWTCache/ActionValidateJWTCache (Method: POST)AppDomain: /LM/W3SVC/1/ROOT/Munjal_Sandbox-159-133665412635002175FilePath: D:\OutSystems\Platform Server\running\Munjal_Sandbox.01131064660\ClientIp: 10.11.186.177 X-Forwarded-For: 82.154.163.121Locale: en-USDateFormat: yyyy-MM-ddPID: 6244 ('w3wp', Started='7/26/2024 11:39:13 AM', Priv=2479Mb, Virt=2123437Mb)TID: 40Thread Name:.NET: 4.0.30319.42000

Stack:

Could not load type 'Microsoft.IdentityModel.Tokens.TokenHandler' from assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
   at ssMunjal_Sandbox.RsseSpaceJWT.JWTServiceAPIClients.ReadTokenService(HeContext heContext, String inParamEncodedToken, Nullable`1 inParamVerifySignature, String inParamSignatureKey, String inParamExpectedSignatureKeyId, Nullable`1 inParamVerifyLifetime, Nullable`1 inParamVerifyIssuer, String inParamExpectedIssuer, Nullable`1 inParamVerifyAudience, String inParamExpectedAudience, String& outParamPlainToken, STJWT_PayloadStructure& outParamTokenPayloadRec, STJWT_HeaderStructure& outParamTokenHeaderRec, Boolean& outParamValidToken, String& outParamResultMessage)
   at ssMunjal_Sandbox.RsseSpaceJWT.ReadTokenService(HeContext heContext, String inParamEncodedToken, Nullable`1 inParamVerifySignature, String inParamSignatureKey, String inParamExpectedSignatureKeyId, Nullable`1 inParamVerifyLifetime, Nullable`1 inParamVerifyIssuer, String inParamExpectedIssuer, Nullable`1 inParamVerifyAudience, String inParamExpectedAudience, String& outParamPlainToken, IRecord& outParamTokenPayloadRec, IRecord& outParamTokenHeaderRec, Boolean& outParamValidToken, String& outParamResultMessage)
   at ssMunjal_Sandbox.ServiceAPIs.ServiceAPIReadTokenService(HeContext heContext, String inParamEncodedToken, Nullable`1 inParamVerifySignature, String inParamSignatureKey, String inParamExpectedSignatureKeyId, Nullable`1 inParamVerifyLifetime, Nullable`1 inParamVerifyIssuer, String inParamExpectedIssuer, Nullable`1 inParamVerifyAudience, String inParamExpectedAudience, String& outParamPlainToken, STJWT_PayloadStructure& outParamTokenPayloadRec, STJWT_HeaderStructure& outParamTokenHeaderRec, Boolean& outParamValidToken, String& outParamResultMessage)
   at ssMunjal_Sandbox.Actions.ActionValidateJWTCache(HeContext heContext, String inParamJWTCacheToken, Boolean& outParamIsValid)
   at ssMunjal_Sandbox.ScreenServices.Munjal_Sandbox_ClientSideCache_JWTCache_Controller.<ActionValidateJWTCache>b__1(HeContext heContext, String screenName, JObject screenModel, JObject inputParameters, JObject clientVariables)
   at OutSystems.RESTService.Controllers.ScreenServicesApiController.endpoint(String input, String endpointName, String apiVersion, EndpointImplementationDelegate implementation)

2024-05-17 04-26-02
Maxime Baracco

Hi Munjal,


I removed the "JWT Secure" component after the upgrades have been ported to the main JWT component.


Can you try downloading the new version of JWT (+ demo component if you need) and see if the error persists? (this library should be version 8.0.0 in this one)


Thank you


2024-01-23 10-16-31
Munjal Subodh

I've tried downloading and re-downloading multiple times. Same error. Even in the demo (see screenshot above)

2024-05-17 04-26-02
Maxime Baracco


Hi Munjal,

I understand that this screenshot was made using the latest version of JWT component? This is not expected because this dependency should be with version 8.0.0.0 there, not 5.2.2.0.

Can you please try to remove/uninstall "JWT Secure", "JWT Demo" & "JWT" modules, then install the latest version of JWT+Demo from the Forge and take the same screenshot if you still have an error?

Thank you

2024-01-23 10-16-31
Munjal Subodh


Hi, I deleted both JWT and JWT (Demo) apps and then reinstalled these from the Forge. I am still getting the same error. 


Also, you guys keep talking about versions but (unless I am very blind), I can't see the versions anywhere so we can't really know what versions we are running - I am not sure how helpful the version numbers are. If I am wrong and there is an easy way to see the versions, I would love to know that. Thanks.



2022-09-07 11-29-00
Miguel Grilo

I have the same issue and the solution was install the version 4.0.6 of JWT and start working.


Best Regards 

Miguel

2024-05-17 04-26-02
Maxime Baracco

Hi Munjal,


The error message that you have is referencing Microsoft.IdentityModel.Tokens version 5.2.2.0, which is one of the libraries used in JWT_Core extension (part of JWT Forge component). Except that in the most recent version of JWT component (version 4.1.2 that you did screenshot), the reference should be to Microsoft.IdentityModel.Tokens version 8.0.0 instead, this is why we have difficulties to understand how you can get this error message.


I also tried to replicate by uninstalling these modules and then reinstalling from the Forge and I cannot manage to generate this error on your screenshot.


Few questions:

  • Are you able to share what you are trying to decode there?
  • Did you create new versions of JWT or JWT demo, which could then lead to merged or duplicated libraries?
  •  Can you create a user for me so I could also login on https://appdev.skillibrium.com/Munjal_Sandbox/Login ?
  • Can you screenshot which modules named "JWT..." you have on your environment? Then I will try to download each and check if there's any broken reference (or global alias redefinition) in one of them.


I should soon update this library to version 8.0.1 (which is the latest stable release from Microsoft), but I might be missing something when I build this solution or get packages since we still can't understand what is causing your error. This is why your help is very appreciated, we might uncover something very important and fix a very impacting issue thanks to your help.


Lastly, it is true that it is not easy to track which version is installed on your environment. But if you click "Install from Forge" from ServiceStudio then search for the component "JWT", you will see a summary like this:

In this screenshot you can see that I have actually a "custom version" installed, not the exact version from the Forge, and I can click "Install version 4.1.2" then "Install anyway" to fix this. Can you share what you see when you try to follow this too?


Thank you

Maxime

2024-01-23 10-16-31
Munjal Subodh

Happy to hop on a call if that would make this easier: munjal@skillibrium.com

2022-09-07 11-29-00
Miguel Grilo

I have the same issue and the solution was install the version 4.0.6 of JWT and start working.


Best Regards 

Miguel

2023-11-10 11-46-42
Diogo Barbosa

I'm having this same error... any news about this?...

2022-03-19 15-14-57
Mohamed Hamza

For me, the problem was resolved by opening the extension in Integration Studio and rebuilding it again 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.