motor-js / motor-ui

The React framework for Qlik Sense mashups
https://motor-js.io
Apache License 2.0
16 stars 4 forks source link

Need change in Config parameters to log into Qliksense Enterprise Edition #12

Open kswamy15 opened 3 years ago

kswamy15 commented 3 years ago

The current config parameters only allow logging into Qlik Cloud environment. Qlik Enterprise edition log in requires a few other parameters. How to make those changes? Cloning repository and npm run build with changes doesn't work - npm run build fails on motor-ui. Errors like ../motor-ui/src/lib/components/visx/components/axis/BaseAxis.tsx(49,24): semantic error TS2554: Expected 3 arguments, but got 2. src\lib\components\visx\components\axis\BaseAxis.tsx

I can make changes and request a pull. Not sure how @motor-js/core works when the repository is named motor-ui

lureilly1 commented 3 years ago

Hey,

Please give me some more details about your set-up and I can advise:

How is authentication handled on your Qlik Sense site? Are you hosting on the server or externally? What additional parameters are you referring to? - like loading certificates or similar?

Thanks, Luke

lureilly1 commented 3 years ago

npm run build should now work fine

kswamy15 commented 3 years ago

We couldn't connect to QlikSense Enterprise using JWT or certificates from a react app. using a JWT token requires sending a header in the Websocket. You can't send a header in a client Webapplication - you can send a header if you run the .js file using the node command. Finally was able to connect using the Engima.js example application where they use the redirect.html in the host name - see here https://github.com/qlik-oss/enigma.js/tree/master/examples/complete/car-models. You have to upload the redirect.html to the Default content library in Qliksense qmc.

Essentially we had to modify the useEngine.jsx to include these lines: const reloadURI = encodeURIComponent(${location.origin}/content/Default/redirect.html); const url = ${location.origin.replace(/^http/, 'ws')}/app/engineData?reloadURI=${reloadURI}; also use this session.on for authentication: session.on('notification:OnAuthenticationInformation', (authInfo) => { if (authInfo.mustAuthenticate) { location.href = authInfo.loginUri; } I am giving this detail so that it could help others to connect to Qliksense Enterprise. You could also make a change in the library to accomodate this. I can make the appropriate and post a pull request - you could see my code and decide on how best to accomodate these changes.

lureilly1 commented 3 years ago

Great, thanks for this. I'll create a branch and implement this into the main library. I'll probably add a new prop to accommodate for this additional log in type.

Worth noting that you can pass the engine object directly to the Motor component. So potentially you can connect via node.js, grab the engine object and pass this to the Motor component in your React app.

ismaelnobregadatascientist commented 3 years ago

I runned the starter locally and it works! But when I deploy it on Netlify the Websocket connection fails.

https://6078dc30aca5fadfaeaad644--laughing-mccarthy-d3be37.netlify.app/

lureilly1 commented 3 years ago

Hey, please can you post your config object and the motor-js version you are using.

ismaelnobregadatascientist commented 3 years ago
export const config = {
//Enter your app config here..
  host: 'qap.sebrae.com.br',
  secure: true,
  port: 443,
  prefix: '',
  appId: 'd183a25e-de1d-47a0-b2a0-459dfbbc20d1'

};

Version of motor: 0.1.8