Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
rbecher
MVP
MVP

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

Astrato.io Head of R&D
Not applicable
Author

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?

rbecher
MVP
MVP

Yeah, this helps! Thanks.

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

Astrato.io Head of R&D
Not applicable
Author

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

rbecher
MVP
MVP

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.

Astrato.io Head of R&D
Not applicable
Author

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.

rbecher
MVP
MVP

req.session.targetId = undefined

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

Astrato.io Head of R&D
Not applicable
Author

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

rbecher
MVP
MVP

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.

Astrato.io Head of R&D