<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to identify the user who invoked the service in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507917#M5709</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to identify the user who invoked the service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One option I'm aware of is based on the appKey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var loggedInUser = Resources["CurrentSessionInfo"].GetCurrentUser();&lt;/P&gt;&lt;P&gt;with this approach, I had to create an appKey for each user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What other options are available? If i didn't want to generate a new appKey for every user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arunkumar D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Apr 2016 13:00:42 GMT</pubDate>
    <dc:creator>arunkumar1</dc:creator>
    <dc:date>2016-04-27T13:00:42Z</dc:date>
    <item>
      <title>How to identify the user who invoked the service</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507917#M5709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to identify the user who invoked the service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One option I'm aware of is based on the appKey&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var loggedInUser = Resources["CurrentSessionInfo"].GetCurrentUser();&lt;/P&gt;&lt;P&gt;with this approach, I had to create an appKey for each user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What other options are available? If i didn't want to generate a new appKey for every user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arunkumar D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2016 13:00:42 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507917#M5709</guid>
      <dc:creator>arunkumar1</dc:creator>
      <dc:date>2016-04-27T13:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the user who invoked the service</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507918#M5710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #4d4d4f; font-family: 'Source Sans Pro', sans-serif; font-size: 13px;"&gt;Resources["CurrentSessionInfo"].GetCurrentUser() doesn't depend on appkeys; it returns whoever the current user is.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Apr 2016 17:00:40 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507918#M5710</guid>
      <dc:creator>ptc-6292103</dc:creator>
      <dc:date>2016-04-27T17:00:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to identify the user who invoked the service</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507919#M5711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nope. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we invoke the service using appKey, GetCurrentUser() would give the user associated with that appKey.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyway, one another approach I found to identify the user is to use Authorization header. Like below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; curl -X POST -u username:password -H "Accept:application/json" -H "Content-Type:application/json" "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://hostname/Thingworx/Things/TestThing/Services/TestAPI" rel="nofollow"&gt;http://hostname/Thingworx/Things/TestThing/Services/TestAPI&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I find this approach would fit me for now, instead of creating an appKey for every user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Arunkumar D&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Apr 2016 06:25:24 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/How-to-identify-the-user-who-invoked-the-service/m-p/507919#M5711</guid>
      <dc:creator>arunkumar1</dc:creator>
      <dc:date>2016-04-28T06:25:24Z</dc:date>
    </item>
  </channel>
</rss>

