Strange bug - Unknown "cryptoJS"

Hi
I'm not sure it's linked to Sphinx but mode WebCore but as it occurs when using TSphinxWebLogin I open it here.
I'm switching a one page Web core app with several webform
On the first page I put a TSphinxWebLogin component
When Login method is call I get an exception

Uncaught (in promise) ReferenceError: CryptoJS is not defined
    at Object.Sha256 (Sphinx.Utils.pas:233:1)
    at Object.CreateState (Sphinx.OidcClient.pas:224:32)
    at async Object.StartAuthorize (Sphinx.OidcClient.pas:431:20)
    at async Object.Login (Sphinx.WebLogin.pas:265:36)

It seems for a strange reason the code is applied in Pas2JS part, since the Sphinx.WebLogin
image

When I check code of WebLogin in IDE the part that appears to be processed at compilation isn't the PAS2JS

At end the error is fired by try to use CryptoJS which is defined in Pas2Js part of Sphinx.utils.pas.

Any idea about the reason it works in this wrong way ?

Note : same test using the webclient in demo works fine with same TSphinxWebLogin Component

Thanks for help
Sylvain

My first question about part of code PAS2JS was due to IDE
In all case, it appears that code applied is well into PAS2JS section for Web Core App

So here, error is about the Crypto instance
But by investigate WebClient demo it discovered project is including Javascript library "crypto.js"
image

Once included, it solved the compilation issue.

Maybe documentation should update to explain this library should be included for web application TSphinxWebLogin

Thanks

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.