Wrong variable used for JWT token Auth in examples/basics/documents/qrs.js
Closed this issue · 0 comments
Description
In order for the sample code to work the signedToken
variable should be used not token
.
Original Code:
const token = {
userDirectory: userDirectory,
userId: userId,
};
...
Skipping further down:
...
// Sign the token using the RS256 algorithm:
const signedToken = jwt.sign(token, key, { algorithm: 'RS256' });
// These are the common request options needed when talking against the Sense
// Enterprise installation from Node.js:
const requestOptions = {
// Toggle this to true if you are not using self-signed certificates:
rejectUnauthorized: false,
headers: {
// We inject our JWT token here:
Authorization: Bearer ${token}
, //INCORRECT - use the signedToken variable!!!
},
};
Steps to Reproduce
N/A
Expected behavior
Authentication occurs
Actual behavior
Error from Qlik Sense Enterprise
Environment
local repo
Library
[ X] Node.js
[ ] Browser
Operating system
[X ] Windows
[ ] OSX
[ ] Linux
Qlik Sense
[ ] Desktop
[ X] Enterprise
Versions
- Node.js:
- Browser:
- Qlik Sense:
- Operating system:
- [Other relevant versions]