<?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 Multiple user accounts implementation in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359231#M3053</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;Let's assume the application need to store&amp;nbsp;multiple user accounts and to be able &lt;STRONG&gt;to switch between them without re-login&lt;/STRONG&gt;. Just like in any Mail app, etc. What is the best approach for achieving this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be specific: users should be logged in using OAuth mechanism via&amp;nbsp;&lt;SPAN style="color: #4c4c4c; font-size: 16px;"&gt;Authentication Manager (&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4c4c4c; font-size: 16px;"&gt;&lt;SPAN class="" style="color: #595959; background-color: #f8f8f8; border-width: 1px 0px 1px 1px; border-style: solid none solid solid; border-top-color: #efefef; border-bottom-color: #efefef; border-left-color: #efefef; padding: 0px 0px 0px 0.15rem;"&gt;AGSAuthenticationManager&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-size: 16px;"&gt;)&lt;SPAN style="color: #3d3d3d;"&gt;. In order to store and use multiple&amp;nbsp;users credentials in the keychain, I'm using&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;enableAutoSyncToKeychain(withIdentifier: , accessGroup:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;, acrossDevices:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;) method call with unique keychain identifier for each user. It works fine but with limitations to switch between stored user credentials.&lt;/SPAN&gt;&lt;BR class="" style="color: #000000;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;While switching between accounts, calling&amp;nbsp;&lt;EM&gt;AGSAuthenticationManager.shared().credentialCache.disableAutoSyncToKeychain()&lt;/EM&gt; and than&amp;nbsp;&lt;EM&gt;AGSAuthenticationManager.shared().credentialCache.enableAutoSyncToKeychain()&lt;/EM&gt; with a keychain identifier for new user doesn't perform the trick and mess things up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;Also, setting the &lt;EM&gt;portal.credential&lt;/EM&gt; to nil doesn't help. The application still have access to the&amp;nbsp;user specific data. Looks like credentials in some way cached in the RAM. So the only way to actually switch between stored user credentials I've found so far, is to &lt;SPAN style="text-decoration: underline;"&gt;recreate the AGSPortal object&lt;/SPAN&gt; from scratch and to call&amp;nbsp;&lt;EM&gt;.enableAutoSyncToKeychain()&lt;/EM&gt; with new identifier after.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;To summarise: is it possible to switch between user/credentials_in_keychain without recreating &lt;EM&gt;AGSPortal&lt;/EM&gt; object? Or what is the suggested way of achieving work with multiple accounts using SDK?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 May 2020 11:36:27 GMT</pubDate>
    <dc:creator>SerhiiKyrylenko</dc:creator>
    <dc:date>2020-05-18T11:36:27Z</dc:date>
    <item>
      <title>Multiple user accounts implementation</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359231#M3053</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;Let's assume the application need to store&amp;nbsp;multiple user accounts and to be able &lt;STRONG&gt;to switch between them without re-login&lt;/STRONG&gt;. Just like in any Mail app, etc. What is the best approach for achieving this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To be specific: users should be logged in using OAuth mechanism via&amp;nbsp;&lt;SPAN style="color: #4c4c4c; font-size: 16px;"&gt;Authentication Manager (&lt;/SPAN&gt;&lt;SPAN class="" style="color: #4c4c4c; font-size: 16px;"&gt;&lt;SPAN class="" style="color: #595959; background-color: #f8f8f8; border-width: 1px 0px 1px 1px; border-style: solid none solid solid; border-top-color: #efefef; border-bottom-color: #efefef; border-left-color: #efefef; padding: 0px 0px 0px 0.15rem;"&gt;AGSAuthenticationManager&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; font-size: 16px;"&gt;)&lt;SPAN style="color: #3d3d3d;"&gt;. In order to store and use multiple&amp;nbsp;users credentials in the keychain, I'm using&amp;nbsp;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;enableAutoSyncToKeychain(withIdentifier: , accessGroup:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;, acrossDevices:&lt;/SPAN&gt;&lt;SPAN style="color: #4c4c4c; background-color: #f8f8f8;"&gt;) method call with unique keychain identifier for each user. It works fine but with limitations to switch between stored user credentials.&lt;/SPAN&gt;&lt;BR class="" style="color: #000000;" /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;While switching between accounts, calling&amp;nbsp;&lt;EM&gt;AGSAuthenticationManager.shared().credentialCache.disableAutoSyncToKeychain()&lt;/EM&gt; and than&amp;nbsp;&lt;EM&gt;AGSAuthenticationManager.shared().credentialCache.enableAutoSyncToKeychain()&lt;/EM&gt; with a keychain identifier for new user doesn't perform the trick and mess things up.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;Also, setting the &lt;EM&gt;portal.credential&lt;/EM&gt; to nil doesn't help. The application still have access to the&amp;nbsp;user specific data. Looks like credentials in some way cached in the RAM. So the only way to actually switch between stored user credentials I've found so far, is to &lt;SPAN style="text-decoration: underline;"&gt;recreate the AGSPortal object&lt;/SPAN&gt; from scratch and to call&amp;nbsp;&lt;EM&gt;.enableAutoSyncToKeychain()&lt;/EM&gt; with new identifier after.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;To summarise: is it possible to switch between user/credentials_in_keychain without recreating &lt;EM&gt;AGSPortal&lt;/EM&gt; object? Or what is the suggested way of achieving work with multiple accounts using SDK?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f8f8f8; color: #4c4c4c; font-size: 16px; "&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2020 11:36:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359231#M3053</guid>
      <dc:creator>SerhiiKyrylenko</dc:creator>
      <dc:date>2020-05-18T11:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple user accounts implementation</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359232#M3054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you call `&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;AGSAuthenticationManager.shared().credentialCache.enableAutoSyncToKeychain&lt;/EM&gt;`, the in-memory&amp;nbsp;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;AGSAuthenticationManager.shared().credentialCache&amp;nbsp;&lt;/EM&gt;is being stored in the Keychain with unique identifier. When you call&amp;nbsp;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;AGSAuthenticationManager.shared().credentialCache.disableAutoSyncToKeychain()&amp;nbsp;&lt;/EM&gt;it just breaks the link between in-memory&amp;nbsp;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;credentialCache&amp;nbsp;&lt;/EM&gt;and entry in the Keychain but in-memory &lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;credentialCache &lt;/EM&gt;is still there.&amp;nbsp;The steps to successfully achieve what you want are,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;AGSAuthenticationManager.shared().credentialCache.disableAutoSyncToKeychain()&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;AGSAuthenticationManager.shared().credentialCache.removeAllCredentials()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="color: #4c4c4c; background-color: #f8f8f8; border: 0px; font-size: 16px;"&gt;3. Create new AGSPortal instance for the new user. This is important because, the portal.credential will be there as well as all portal has other properties and content specific to the user.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when you want to switch user, you can call it is SignOut/LogOut and in that you do,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. DisableAutoSyncToKeychain&lt;/P&gt;&lt;P&gt;2. RemoveAllCredentials&lt;/P&gt;&lt;P&gt;3. Set portal = nil&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nimesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2020 14:45:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359232#M3054</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2020-05-18T14:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple user accounts implementation</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359233#M3055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you,&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;Nimesh&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;With those inputs I'm able to achieve exactly what I need by following such steps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;disableAutoSyncToKeychain()&lt;/LI&gt;&lt;LI&gt;removeAllCredentials()&lt;/LI&gt;&lt;LI&gt;portal.credential = nil&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least for my use case, it's not necessary to setting AGSPortal to nil. Now setting portal credentials to nil works, because in addition I've removed credentials from cache(missing step from my first approach)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2020 15:04:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/multiple-user-accounts-implementation/m-p/359233#M3055</guid>
      <dc:creator>SerhiiKyrylenko</dc:creator>
      <dc:date>2020-05-18T15:04:36Z</dc:date>
    </item>
  </channel>
</rss>

