<?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: How to get UserID of user that is currently signed in to application? in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799273#M4998</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can use this way(&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;IdentityManager.credentials[0].userId&lt;/SPAN&gt;) even though your portal is authenticated by IWA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Sep 2015 03:12:21 GMT</pubDate>
    <dc:creator>JunshanLiu</dc:creator>
    <dc:date>2015-09-01T03:12:21Z</dc:date>
    <item>
      <title>How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799268#M4993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a widget we need to be able to grab the UserID of the user currently logged in to the app (e.g. assuming they have signed in via AGOL or Portal), and then pass this userID as a string input parameter to another web service. Is this possible? Any ideas on how we can access current userID?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have previously been using Geocortex Essentials and Workflow Designer, and there was a "GetCurrentUser" activity that made this very easy to do, and I was hoping there might be something like this that can be used in a Widget?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I saw that the Javascript API has a method called "Credential"&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/jsapi/credential-amd.html" title="https://developers.arcgis.com/javascript/jsapi/credential-amd.html"&gt;Credential | API Reference | ArcGIS API for JavaScript&lt;/A&gt;&amp;nbsp; that includes UserID, but I am not sure I understand&amp;nbsp; where we would call this or, or if we can even access the credentials from within a Widget once the user has already authenticated?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for any feedback/ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For reference, I have already looked at following threads relating to securing applications to try to better understand how authentication works for Web Apps made with WAB Dev Edition (though am still digesting the material to make sense...):&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/119526"&gt;Authentication through ArcGIS Online for customized Web Apps&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/146074"&gt;Second login prompts while authenticating arcgis online with oAuth&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2015 23:29:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799268#M4993</guid>
      <dc:creator>PascualBenito</dc:creator>
      <dc:date>2015-08-25T23:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799269#M4994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Pascual, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can use the &lt;SPAN style="line-height: 1.5;"&gt;singleton&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt; I&lt;/SPAN&gt;&lt;SPAN style="line-height: 1.5;"&gt;dentityManager for this.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add IdentityManager to your widget and access credentials through this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;define([&lt;/P&gt;&lt;P&gt;&amp;nbsp; 'esri/IdentityManager',&lt;/P&gt;&lt;P&gt;&amp;nbsp; ],&lt;/P&gt;&lt;P&gt; function(&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; IdentityManager){&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; console.log(IdentityManager.credentials[0].userId)&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You probably will want to add some checks to see if user is signed in as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read more: &lt;A href="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html" title="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html"&gt;IdentityManager | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 09:06:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799269#M4994</guid>
      <dc:creator>HerdisGudbrandsdottir</dc:creator>
      <dc:date>2015-08-26T09:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799270#M4995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/13963"&gt;Herdis Gudbrandsdottir&lt;/A&gt;, thank you for pointing us in right direction! We will test this out. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see that this sample code will be useful to see in action: &lt;A href="https://developers.arcgis.com/javascript/jssamples/portal_oauth_inline.html" style="line-height: 1.5;" title="https://developers.arcgis.com/javascript/jssamples/portal_oauth_inline.html"&gt;OAuth Basic | ArcGIS API for JavaScript&lt;/A&gt;&lt;SPAN style="line-height: 1.5;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For checking to see if the user is signed in or not, it looks like we would use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html#checksigninstatus" title="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html#checksigninstatus"&gt;checksigninstatus&lt;/A&gt; method, correct?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, do you know if there might be any limitations on this approach if users are authenticating via Portal for Server configured to use Integrated Windows Authentication (IWA)? That is, does the Javascript IdentityManager support IWA?&amp;nbsp; I found the following description of IdentityManger in context of ArcGIS RunTime SDK for .NET that suggests it should work:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P style="margin-bottom: 10px; color: #4d4d4d; font-family: Arial, Helvetica, sans-serif;"&gt;&lt;SPAN class="caption" style="font-size: 11px; color: #666666; font-weight: bold;"&gt;Listing 13&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 10px; color: #4d4d4d; font-family: Arial, Helvetica, sans-serif;"&gt;IdentityManager supports accessing resources on systems secured using ArcGIS tokens, OAuth, network authentication (e.g., Integrated Windows Authentication &lt;EM&gt;[IWA]&lt;/EM&gt;), and client certificates. This includes secure resources hosted by ArcGIS for Server, Portal for ArcGIS, and ArcGIS Online. A set of classes is derived from Esri.ArcGISRuntime.Security.Credential to reference different types of security protocols. These include ArcGISTokenCredential, OAuthTokenCredential, ArcGISNetworkCredential, and CertificateCredential. During a challenge, use CredentialRequestInfo.AuthenicationType to determine the type of credential to create or return.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;(&lt;EM&gt;Source:&lt;/EM&gt; &lt;A href="http://www.esri.com/esri-news/arcuser/winter-2015/integrate-gis-functionality-into-windows-apps-with-arcgis-online-runtime-sdk-for-net" title="http://www.esri.com/esri-news/arcuser/winter-2015/integrate-gis-functionality-into-windows-apps-with-arcgis-online-runtime-sdk-for-net"&gt;Integrate GIS Functionality into Windows Apps with ArcGIS Runtime SDK for .NET | ArcUser&lt;/A&gt; )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but I could not tell if this description was specific only to the the support provided by the .NET runtime?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 09:55:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799270#M4995</guid>
      <dc:creator>PascualBenito</dc:creator>
      <dc:date>2015-08-26T09:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799271#M4996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would take a look at esri.arcgis.Portal and &lt;A href="https://developers.arcgis.com/javascript/jsapi/portal.html#getportaluser" style="color: #00629b; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;getPortalUser()&lt;/A&gt; for cases where user is signed in using IWA:&lt;/P&gt;&lt;P&gt; &lt;A href="https://developers.arcgis.com/javascript/jsapi/portal.html" title="https://developers.arcgis.com/javascript/jsapi/portal.html"&gt;Portal (legacy) | API Reference | ArcGIS API for JavaScript&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And yes &lt;A href="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html#checksigninstatus" style="color: #00629b; font-family: 'Lucida Grande', 'Segoe UI', Arial, sans-serif;"&gt;checkSignInStatus(resUrl)&lt;/A&gt; would be the correct way to get hold of the credential object&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Aug 2015 11:03:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799271#M4996</guid>
      <dc:creator>HerdisGudbrandsdottir</dc:creator>
      <dc:date>2015-08-26T11:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799272#M4997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Herdis.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 01:09:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799272#M4997</guid>
      <dc:creator>PascualBenito</dc:creator>
      <dc:date>2015-09-01T01:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799273#M4998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can use this way(&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;IdentityManager.credentials[0].userId&lt;/SPAN&gt;) even though your portal is authenticated by IWA.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 03:12:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799273#M4998</guid>
      <dc:creator>JunshanLiu</dc:creator>
      <dc:date>2015-09-01T03:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get UserID of user that is currently signed in to application?</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799274#M4999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Junshan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2015 03:19:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-get-userid-of-user-that-is-currently-signed/m-p/799274#M4999</guid>
      <dc:creator>PascualBenito</dc:creator>
      <dc:date>2015-09-01T03:19:59Z</dc:date>
    </item>
  </channel>
</rss>

