Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No authentication with accessToken #86

Open
Vinciepincie opened this issue Sep 18, 2024 · 2 comments
Open

No authentication with accessToken #86

Vinciepincie opened this issue Sep 18, 2024 · 2 comments

Comments

@Vinciepincie
Copy link

Vinciepincie commented Sep 18, 2024

There seems to be no way to use an existing accessToken for authentication in here.
When you have a javascript backend this is no problem, however this package becomes useless if you don't.

I don't think it would take much effort to implement, i assume it just needs to skip the initial authentication process used to get the access token since that's already done.

Context where this is needed:
I'm working on a narrowcasting application where organizations can setup playlists with content (like Qlik sheets) to be displayed on screens. The authentication is done in our php backend via M2M oAuth. We have a Vue.js frontend.

Now if i want to get a list of sheets to select i have to use qlik-embed which is a bit odd for this. It already requires a sheet to be set before fetching sheets.

@nilzona
Copy link
Contributor

nilzona commented Sep 18, 2024

Hey @Vinciepincie

Have you tried using the auth-module apikey with your token as the apiKey in the host-config?

Basically what it does is set headers to the api calls as:

headers: {
  Authorization: `Bearer ${hostConfig?.apiKey}`,
},

So existing tokens can be used through the apikey auth module.

hostConfig: {
 apiKey: "<token>"
}

@goldbergjeffrey
Copy link
Member

@Vinciepincie , you should not use M2M for front-end applications. You can use OAuth impersonation and use the backend to acquire a frontend access token you can then store in session storage or temporarily.

If you're looking to get a sheet list, you can use qlik-api or qlik-embed to get it, just make sure you're referencing the access token via function.

See here for impersonation auth: https://qlik.dev/examples/authenticate-examples/oauth-m2m-impersonation/
and here for using qlik-api to get list of sheets: https://qlik.dev/examples/qlik-api-examples/app-sheet-list/#nodejs-using-an-api-key

A combination of these two should get what you want. Then you can add qlik-embed using the same access token (or a new one for the same user) and access the dom to change sheets.

https://qlikembed.qlikpoc.com/#sheet-nav Use the dropdown and flip between sales analytics and payables...or it may break. Some of the sheets are a bit janky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants