Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
Not applicable

qlik-auth.js

Hi guys,

Im using the qlik-auth.js in my custom authentication module. Everything works great except for deleting the session.

So when a user clicks on logout the application directs him to /logout route where the deleteSession(req, res, profile, options) is fired


However i am getting the following error and haven't found a way to fix it:

No matching endpoint found

^

SyntaxError: Unexpected token N

    at Object.parse (native)

    at IncomingMessage.<anonymous> (C:\****

project\node_modules\qlik-auth\index.js:307:35)

    at emitOne (events.js:77:13)

    at IncomingMessage.emit (events.js:169:7)

    at IncomingMessage.Readable.read (_stream_readable.js:360:10)

    at flow (_stream_readable.js:743:26)

    at resume_ (_stream_readable.js:723:3)

    at doNTCallback2 (node.js:439:9)

    at process._tickCallback (node.js:353:17)

[nodemon] app crashed - waiting for file changes before starting...

Thanks for any help.

13 Replies
MVP & Luminary
MVP & Luminary

Re: qlik-auth.js

Hi,

I have some similar issues and found that there are some wrong codings:

It contains some tests like

if(cert.indexOf(".pem")) // or similar

..but it has to be:

if(cert.indexOf(".pem") >0)

So, for me this has fixed thing where I coming to the point I get stucked: why and how I gonna pass the parameter TargetId? This TargetId is server-site generated. I cannot generate on I need to pass to deleteSession.

Any idea?

- Ralf

Not applicable

Re: qlik-auth.js

can you just store the targetId id ad proxyURI in a your session?

req.session.TargetId = url.parse(req.url, true).query.targetId ;

req.session.proxyRestUri = url.parse(req.url, true).query.proxyRestUri ;

Than pass the session property as the parameter?

MVP & Luminary
MVP & Luminary

Re: qlik-auth.js

Yeah, this helps! Thanks.

But still no idea why it needs a targetId because it doesn't need to redirect anywhere..

Not applicable

Re: qlik-auth.js

Im actually not sure if its a mandatory field? The api documentation could be improved substantially.

MVP & Luminary
MVP & Luminary

Re: qlik-auth.js

If I store targetId and proxyRestUri in req.session of authentication module it's gone after the redirect. Any idea? It seems to be that the authentication call is made in a seperate session.

Not applicable

Re: qlik-auth.js

Shouldnt be. If you console.log(req.session.targetID) in your final destination url what does it return?  One thing to do is use Redis or mongo etc and store the session information. This improves the user experience. For example in your login form you could have a field 'remember me', if checked would store the session in your db.

MVP & Luminary
MVP & Luminary

Re: qlik-auth.js

req.session.targetId = undefined

I would like to build this w/o a database inbetween..

Not applicable

Re: qlik-auth.js

It would be easier to help if you shared your code.

MVP & Luminary
MVP & Luminary

Re: qlik-auth.js

I'm just using qlikauth.init(req, res) which sets the needed values and the deleteSession().

But I would use another Logout method but haven't seen any workable code. All QPS DELETE messages I've tried giving a status 500.