npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qlik-session-auth

v1.0.0

Published

Qlik Sense Session API authentication module for Node.js

Downloads

35

Readme

qlik-session-auth

Qlik Sense Session API authentication module for Node.js.

Prerequisite

  • Qlik Sense server and node.js server are installed on the same machine, or they are hosted on two servers accessible by FQDN under a single domain.

    ex) qs01.mydomain.com (Qlik Sense server) and portal.mydomain.com (Node.js server)

  • Tested with Qlik Sense v3.2SR2 and Node v6.10.1.

Installation and Setup

Node.js

Create a node.js project and onstall qlik-session-auth package

npm install --save qlik-session-auth

Load qlik-session-auth and express-session module

// Load qlik-session-auth module
var QlikSession = require('qlik-session-auth');

// Load express-session to store session data
var session = require('express-session');

Setup to store cookie based session. The key needs to be the as the session cookie header name on Qlik Sense which will be setup later. When Qlik Sense server and node.js server are hosted on separated servers, domain needs to be added in the cookie setting.

app.use(cookieParser('4803fd7c4e75c048dab014adacc9b22e665785ef'));

app.use(session({
  secret: '4803fd7c4e75c048dab014adacc9b22e665785ef',
  key: 'X-Qlik-Session-portal',
  resave: false,
  saveUninitialized: true,
  cookie: { domain: '.mydomain.com' },
}));

Define config options for Qlik Sense Session API and profile of login user.

// Config for Qlik Sense Session API
const options = {
  host: 'qs02.mydomain.com',
  port: 4243,
  prefix: '/portal',
  xrfkey: 'abcdefghijklmnop',
  pfx: 'C:\\Cert\\client.pfx',
  passphrase: '',
  isSecure: true,
};

// Config for login user
const profile = {
  userDirectory: 'portal',
  userId: 'john_doe',
  sessionId: uuid.v4(), // e.g. 32a4fbed-676d-47f9-a321-cb2f267e2918
};

Initialize QlikSession instance with options and profile and call addSession method.

var qps = new QlikSession(options, profile);

qps.addSession().then(
  function(res){
    console.log(res)
  },
  function(err){
    console.log(err);
});

When you get or delete QlikSession, call the following methods.

qps.getSession().then(....)

qps.deleteSession().then(....)

Qlik Sense

  • Open 4243 port for QPS API as well as 80/443 ports for user access.

  • Create a new virtual proxy for session authentication. Here is a sample configuration:

    • Description/Prefix - portal
    • Session cookie header name - X-Qlik-Session-portal (The same name as the session key on the node.js)
    • Authentication method - Ticket
    • Authentication module redirect URI - http://qs01.mydomain.com
    • Load balancing nodes - Central
  • Add "Access-Control-Allow-Origin:*" to "Additional response headers" on the virtual proxy settings.

    https://community.qlik.com/thread/185385

  • Add the domain name to "Host white list" on the virtual proxy settings. ex) mydomain.com

    https://community.qlik.com/thread/166842

Author

Masaki Hamano

  • http://github.com/mhamano

Change Log

See CHANGELOG

License & Copyright

The software is made available "AS IS" without any warranty of any kind under the MIT License (MIT).

See Additional license information for this solution.