<?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: Portal login programmatically in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1003869#M5769</link>
    <description>&lt;P&gt;Thank for your reply&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally I noticed some custom property in the configurationmanager class or from module seems to change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't pin point it&amp;nbsp; yet. The object is retained but it does not execute correctly.&lt;/P&gt;&lt;P&gt;Example : I initialized the log4net log manager object in initialize method, but in subsequent class (in startup page viewmodel, dockpane viewmodel) the logging mechanism seem to corrupt.&lt;/P&gt;&lt;P&gt;I have to initialized those object in OnApplicationReady event as well.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2020 06:32:47 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2020-11-23T06:32:47Z</dc:date>
    <item>
      <title>Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1000543#M5726</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am using this code to automatically login into ArcGIS portal, it is working perfectly in 2.5.&lt;/P&gt;&lt;P&gt;We have setup new environment to test existing addin with 2.6, repackage with 2.6 nugget and deployed.&lt;/P&gt;&lt;P&gt;The code snippet I am currently using is -&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; private void ForceLoginToDefinedPortal()
        {
var portals = ArcGISPortalManager.Current.GetPortals();
            var resultPortal = portals.FirstOrDefault(p =&amp;gt; p.PortalUri.Host.Equals(this.Config.DefaultPortal, StringComparison.OrdinalIgnoreCase));
            this.ModuleLogManager.LogInfo($"Got registered portal {resultPortal != null}");
            try
            {
                if (resultPortal != null)
                {
                    this.ModuleLogManager.LogInfo($"switch active portal to {this.Config.DefaultPortal}");

                    ArcGISPortalManager.Current.SetActivePortal(resultPortal);
                    this.ModuleLogManager.LogInfo($"Start sign in to active portal to {this.Config.DefaultPortal}");

                    resultPortal.SignIn();
                    this.ModuleLogManager.LogInfo($"Sign in success to active portal to {this.Config.DefaultPortal}");

                }
            }
            catch (Exception loginExcep)
            {
                string err = $"login issue {loginExcep.Message}{Environment.NewLine}{loginExcep.StackTrace}";
                this.ModuleLogManager.LogError(err);
            }
}&lt;/LI-CODE&gt;&lt;P&gt;In 2.6 I got exception and below is the detail log&lt;/P&gt;&lt;P&gt;INFO ||2020-11-12 05:05:47||Username:ProAddinTestUser||Current Login User ProAddinTestUser&lt;BR /&gt;INFO ||2020-11-12 05:05:47||Username:ProAddinTestUser||Config App initialized success&lt;BR /&gt;INFO ||2020-11-12 05:05:47||Username:ProAddinTestUser||Got registered portal True&lt;BR /&gt;INFO ||2020-11-12 05:05:47||Username:ProAddinTestUser||switch active portal to dummyportal.com.au&lt;BR /&gt;INFO ||2020-11-12 05:05:47||Username:ProAddinTestUser||Start sign in to active portal to dummyportal.com.au&lt;BR /&gt;ERROR ||2020-11-12 05:05:47||Username:ProAddinTestUser||login issue &lt;STRONG&gt;Error HRESULT E_FAIL has been returned from a call to a COM component.&lt;/STRONG&gt;&lt;BR /&gt;at ArcGIS.Desktop.Internal.Framework.IAGOSignOnService.GetToken(String portalURL)&lt;BR /&gt;at ArcGIS.Desktop.Core.ArcGISPortal.SignIn()&lt;BR /&gt;at ProConfigurationManager.ForceLoginToDefinedPortal() in&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't get any login prompt and got that exception only, the designated portal is using IWA auth.&lt;/P&gt;&lt;P&gt;Any Idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 06:54:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1000543#M5726</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-12T06:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1000563#M5727</link>
      <description>&lt;P&gt;Do you have a reverse proxy in between?&lt;/P&gt;&lt;P&gt;(Ex. When you go to https://mahinename/portalwebadaptor/home does it redirect you to another page for login?&lt;/P&gt;&lt;P&gt;I faced a similar issue and we had to disable the reverse proxy to achieve this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 07:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1000563#M5727</guid>
      <dc:creator>YatharthSah</dc:creator>
      <dc:date>2020-11-12T07:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1001017#M5732</link>
      <description>&lt;P&gt;Thank&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/91954"&gt;@YatharthSah&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Is does look like that and it is a good point.&lt;/P&gt;&lt;P&gt;I wish to update pro.exe.config file with fiddler proxy and test as well but IT does not allow me to.&lt;/P&gt;&lt;P&gt;I will check with them how the internet traffic from that image is going through.&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Than&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 05:44:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1001017#M5732</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-13T05:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1001112#M5733</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;Manage to solve it today.&lt;/P&gt;&lt;P&gt;The issue is where I called this method, need to call that method only when application is ready.&lt;/P&gt;&lt;P&gt;In ApplicationReady event, previously I called it at Applicationinitializing event.&lt;/P&gt;&lt;P&gt;It seems, application loading sequence might change in 2.6.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 08:32:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1001112#M5733</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-13T08:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1002790#M5754</link>
      <description>&lt;P&gt;I had the same issue and had to move my code to OnApplictionReady from OnApplicationInitilize.&amp;nbsp; It worked for years and then 2.6 came out and I started getting the COM error.&amp;nbsp; I wonder what has changed in the start up sequence.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;protected override void OnApplicationReady()&lt;BR /&gt;{&lt;BR /&gt;// get the login username from Portal&lt;BR /&gt;var portal = ArcGISPortalManager.Current.GetActivePortal();&lt;BR /&gt;//Module1.UserName = portal.GetSignOnUsername();&lt;/P&gt;&lt;P&gt;if (portal != null &amp;amp;&amp;amp; portal.SignIn().success)&lt;BR /&gt;{&lt;BR /&gt;Module1.UserName = portal.GetSignOnUsername();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2020 23:25:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1002790#M5754</guid>
      <dc:creator>RobBurke</dc:creator>
      <dc:date>2020-11-18T23:25:19Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1003578#M5766</link>
      <description>&lt;P&gt;Thanks for this Than. This is a bug. 2.7 is almost final and so we cannot get the fix in for 2.7. We will fix this in 2.8&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2020 18:45:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1003578#M5766</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2020-11-20T18:45:55Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1003869#M5769</link>
      <description>&lt;P&gt;Thank for your reply&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/145101"&gt;@CharlesMacleod&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Additionally I noticed some custom property in the configurationmanager class or from module seems to change.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't pin point it&amp;nbsp; yet. The object is retained but it does not execute correctly.&lt;/P&gt;&lt;P&gt;Example : I initialized the log4net log manager object in initialize method, but in subsequent class (in startup page viewmodel, dockpane viewmodel) the logging mechanism seem to corrupt.&lt;/P&gt;&lt;P&gt;I have to initialized those object in OnApplicationReady event as well.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2020 06:32:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1003869#M5769</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2020-11-23T06:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1063445#M6631</link>
      <description>&lt;P&gt;I've just tried it out with the latest 2.8 and we still have the problem!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jun 2021 07:03:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1063445#M6631</guid>
      <dc:creator>BrunoScott</dc:creator>
      <dc:date>2021-06-01T07:03:44Z</dc:date>
    </item>
    <item>
      <title>Re: Portal login programmatically</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1213308#M8753</link>
      <description>&lt;P&gt;How do you handle when the token has expired and you have to input the password?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 08:40:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/portal-login-programmatically/m-p/1213308#M8753</guid>
      <dc:creator>Vidar</dc:creator>
      <dc:date>2022-09-16T08:40:22Z</dc:date>
    </item>
  </channel>
</rss>

