Search code examples
meteorintuit-partner-platform

How to pass a meteor user name to a invoking java script as a argument from HTML


Here is the sample code. I am invoking this javascript from HTML with menuProxy and grantUrl as argument, to grant url I want to attach meteor userid as a query parameter. Please advise on how to achieve this.

intuit.ipp.anywhere.setup({
  menuProxy: 'http://x.x.x.x:8080/QuickbooksV3API/bluedot.htm',
  grantUrl: 'http://x.x.x.x:8080/QuickbooksV3API/requesttoken.htm'+'?custId='+ {{currentUser.username}}
});

I get following error when I try to run "Uncaught SyntaxError: Unexpected token {" as it is confused meteor handle bar with JSON format.


Solution

  • You can't use handlebars syntax in Javascript. However, calling Meteor.user in Javascript will give you the same result as {{currentUser}} in templates.

    grantUrl: 'http://x.x.x.x:8080/QuickbooksV3API/requesttoken.htm?custId='
               + Meteor.user().username