<?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 Re: Login Implementation with username password via Things Service for mobile application Thingworx in ThingWorx Developers</title>
    <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Login-Implementation-with-username-password-via-Things-Service/m-p/663244#M44778</link>
    <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/300754"&gt;@sushantpatekar&lt;/a&gt;&amp;nbsp;, Not quite sure that I can address all of your questions. I have used a couple of different REST API calls to get information on the users in the system.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a list of the users defined in the system. For my testing I used POSTMAN. The first question I tried to answer was can I get a list of the users on the system. To do this requires that I have an AppKey, you only do not want to share information with just anyone.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get Transaction
&lt;UL&gt;
&lt;LI&gt;URL: &lt;A href="http://localhost/Thingworx/Users" target="_blank"&gt;http://localhost/Thingworx/Users&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Header values
&lt;UL&gt;
&lt;LI&gt;appkey : &amp;lt;key value with priv to see users&amp;gt;&lt;/LI&gt;
&lt;LI&gt;Accept : text/xml
&lt;UL&gt;
&lt;LI&gt;I used this because I thought something you can parse is better other values exist such as "text/csv", "text/html"...&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;This returned a XML document which contained the list of user names.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Second question now that I know a user name can I get information about that user&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get Transaction
&lt;UL&gt;
&lt;LI&gt;url:&amp;nbsp;&lt;SPAN&gt;http://localhost/Thingworx/Users/TestUserName&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Header values
&lt;UL&gt;
&lt;LI&gt;appkey : &amp;lt;key value with priv to see users&amp;gt;&lt;/LI&gt;
&lt;LI&gt;Accept : text/csv&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;This reply is a success (200). But not a lot of data. Take a look at the following URL to get an idea of what you can request.&amp;nbsp;&lt;A href="http://localhost/Thingworx/Users/TestUserName" target="_blank"&gt;http://&amp;lt;youtThingWorx:&amp;lt;port&amp;gt;/Thingworx/Users/&amp;lt;known UserName&amp;gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In your post you are trying to make a REST API call and perform a login. Try the following.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;POST transaction
&lt;UL&gt;
&lt;LI&gt;URL:&amp;nbsp;&lt;SPAN&gt;localhost/Thingworx/action-login&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Header
&lt;UL&gt;
&lt;LI&gt;Accept : text/csv&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Body x-www-form-urlencoded
&lt;UL&gt;
&lt;LI&gt;thingworx-form-userid : &amp;lt;user name&amp;gt;&lt;/LI&gt;
&lt;LI&gt;thingworx-form-password : &amp;lt;password&amp;gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;In my testing with POSTMAN this returned a status of 200, and a session ID&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Now an item to be considered this approach is sending a username and password as clear text between a device and a server. NOT good security&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;</description>
    <pubDate>Wed, 29 Apr 2020 18:32:17 GMT</pubDate>
    <dc:creator>PEHOWE</dc:creator>
    <dc:date>2020-04-29T18:32:17Z</dc:date>
    <item>
      <title>Login Implementation with username password via Things Service for mobile application Thingworx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Login-Implementation-with-username-password-via-Things-Service/m-p/662474#M44641</link>
      <description>&lt;P&gt;I am developing a mobile app that communicates with TWX via REST API. I have created MobileConnector_TH which having services that pull the data and revert it to mobile via HTTP Rest API.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Problem statement:-&lt;/P&gt;
&lt;P&gt;I have one service written in MobileConnector_TH - validateUser(Username, Password)&lt;/P&gt;
&lt;P&gt;Which contains the following code&lt;/P&gt;
&lt;P&gt;var params = {&lt;BR /&gt;&lt;BR /&gt;url: me.IPUrl+"/Thingworx/action-login?OrganizationName="+organization+"&amp;amp;thingworx-form-userid="+username+"&amp;amp;thingworx-form-password="+password+"&amp;amp;x-thingworx-session=true" /* STRING */,&lt;BR /&gt;&lt;BR /&gt;contentType: "text/html" /* STRING */&lt;BR /&gt;&lt;BR /&gt;};&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;// result: STRING&lt;BR /&gt;&lt;BR /&gt;var result = Resources["ContentLoaderFunctions"].GetText(params);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This returns HTML webpage data into a string. I am unable to find any specific scenario to validate username&amp;amp;Password via Service. It showing the same result with the wrong password/username.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.ptc.com/t5/ThingWorx-Developers/Authentication-with-User-Credentials-via-Rest-Api/td-p/585890" target="_blank"&gt;https://community.ptc.com/t5/ThingWorx-Developers/Authentication-with-User-Credentials-via-Rest-Api/td-p/585890&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Apr 2020 09:51:30 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Login-Implementation-with-username-password-via-Things-Service/m-p/662474#M44641</guid>
      <dc:creator>sushantpatekar</dc:creator>
      <dc:date>2020-04-25T09:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: Login Implementation with username password via Things Service for mobile application Thingworx</title>
      <link>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Login-Implementation-with-username-password-via-Things-Service/m-p/663244#M44778</link>
      <description>&lt;P&gt;&lt;a href="https://www.ptcusercommunity.com/t5/user/viewprofilepage/user-id/300754"&gt;@sushantpatekar&lt;/a&gt;&amp;nbsp;, Not quite sure that I can address all of your questions. I have used a couple of different REST API calls to get information on the users in the system.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get a list of the users defined in the system. For my testing I used POSTMAN. The first question I tried to answer was can I get a list of the users on the system. To do this requires that I have an AppKey, you only do not want to share information with just anyone.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get Transaction
&lt;UL&gt;
&lt;LI&gt;URL: &lt;A href="http://localhost/Thingworx/Users" target="_blank"&gt;http://localhost/Thingworx/Users&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;Header values
&lt;UL&gt;
&lt;LI&gt;appkey : &amp;lt;key value with priv to see users&amp;gt;&lt;/LI&gt;
&lt;LI&gt;Accept : text/xml
&lt;UL&gt;
&lt;LI&gt;I used this because I thought something you can parse is better other values exist such as "text/csv", "text/html"...&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;This returned a XML document which contained the list of user names.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Second question now that I know a user name can I get information about that user&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Get Transaction
&lt;UL&gt;
&lt;LI&gt;url:&amp;nbsp;&lt;SPAN&gt;http://localhost/Thingworx/Users/TestUserName&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Header values
&lt;UL&gt;
&lt;LI&gt;appkey : &amp;lt;key value with priv to see users&amp;gt;&lt;/LI&gt;
&lt;LI&gt;Accept : text/csv&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;This reply is a success (200). But not a lot of data. Take a look at the following URL to get an idea of what you can request.&amp;nbsp;&lt;A href="http://localhost/Thingworx/Users/TestUserName" target="_blank"&gt;http://&amp;lt;youtThingWorx:&amp;lt;port&amp;gt;/Thingworx/Users/&amp;lt;known UserName&amp;gt;&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In your post you are trying to make a REST API call and perform a login. Try the following.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;POST transaction
&lt;UL&gt;
&lt;LI&gt;URL:&amp;nbsp;&lt;SPAN&gt;localhost/Thingworx/action-login&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Header
&lt;UL&gt;
&lt;LI&gt;Accept : text/csv&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;Body x-www-form-urlencoded
&lt;UL&gt;
&lt;LI&gt;thingworx-form-userid : &amp;lt;user name&amp;gt;&lt;/LI&gt;
&lt;LI&gt;thingworx-form-password : &amp;lt;password&amp;gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;In my testing with POSTMAN this returned a status of 200, and a session ID&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Now an item to be considered this approach is sending a username and password as clear text between a device and a server. NOT good security&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know if this helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Peter&lt;/P&gt;</description>
      <pubDate>Wed, 29 Apr 2020 18:32:17 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/ThingWorx-Developers/Login-Implementation-with-username-password-via-Things-Service/m-p/663244#M44778</guid>
      <dc:creator>PEHOWE</dc:creator>
      <dc:date>2020-04-29T18:32:17Z</dc:date>
    </item>
  </channel>
</rss>

