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.
Luminary
Luminary

authenticated user

Hi,

I'm writing an extension, but I need to get the authenticated user.

Currently

var global = qlik.getGlobal();

  

     var  vUser = '';

       global.getAuthenticatedUser(function(reply){

             alert('User:'+reply.qReturn);

  vUser =  reply.qReturn;

  console.log(reply.qReturn);

       });

gives me 'Personal\Me'

What is the official code in Javascript to get the authenticated user in Qlik Sense. It would be appreciated if I did not have to call the Global Qlik object.

Kind Regards,

Dion

Tags (1)
1 Solution

Accepted Solutions
Employee
Employee

Re: authenticated user

Ye that's the way to get the authenticated user. The reason you are getting Personal\Me is because you are most likely running your code against a Sense Desktop installation which does not have any authentication/users.

3 Replies
Employee
Employee

Re: authenticated user

Ye that's the way to get the authenticated user. The reason you are getting Personal\Me is because you are most likely running your code against a Sense Desktop installation which does not have any authentication/users.

erik_wetterberg
Honored Contributor

Re: authenticated user

Hi dion,

In an extension there is another possibility. You can use the initialProperties of your extension and add an expression that gives you the authenticated user, something like this:

initialProperties:{

  user:{

qStringExpression: "=OSUser ()"

  },

  .....

Now when your paint method is called you will have the user id in layout.user.

But, of course in desktop you will get personal\me.

Hope this helps.

Erik

Erik Wetterberg
https://extendingqlik.upper88.com/
Luminary
Luminary

Re: authenticated user

Thanks,

This confirms my findings.

Kind Regards

Dion