<?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: Is it possible to enter credentials in code? in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1101027#M7116</link>
    <description>&lt;P&gt;Note also that you can lean on the keychain to reduce the frequency with which users will be asked to log in. You can look at &lt;A href="https://developers.arcgis.com/ios/api-reference/interface_a_g_s_authentication_manager.html#acf11285e729290bb71b68685f32c0c24" target="_self"&gt;&lt;STRONG&gt;AGSAuthenticationManager.shared.credentialCache&lt;/STRONG&gt;&lt;/A&gt; and call &lt;A href="https://developers.arcgis.com/ios/api-reference/interface_a_g_s_credential_cache.html#ae51a54ec9742174990e7f56744aef329" target="_self"&gt;&lt;STRONG&gt;enableAutoSyncToKeychain()&lt;/STRONG&gt;&lt;/A&gt;. This will securely cache credentials in the keychain, ready for your user to use next time they open the app.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Sep 2021 21:13:05 GMT</pubDate>
    <dc:creator>Nicholas-Furness</dc:creator>
    <dc:date>2021-09-22T21:13:05Z</dc:date>
    <item>
      <title>Is it possible to enter credentials in code?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100613#M7111</link>
      <description>&lt;P&gt;I'm loading a map that has some specific layers through a server that is password protected. I'd like to be able to enter the username and password in code and NOT have this popup occur. I know you can cache it and it will log itself in when you leave the screen and go back, but is there a way to get the initial login to occur through code and even update as necessary as long as username and password do not change? I'm trying to prevent my users from doing too much work in order to use this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-09-21 at 7.13.48 PM.png" style="width: 117px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/23576i396BFEA4CD18BC99/image-size/small?v=v2&amp;amp;px=200" role="button" title="Screen Shot 2021-09-21 at 7.13.48 PM.png" alt="Screen Shot 2021-09-21 at 7.13.48 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 01:16:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100613#M7111</guid>
      <dc:creator>ThomasKellough</dc:creator>
      <dc:date>2021-09-22T01:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to enter credentials in code?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100633#M7112</link>
      <description>&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;It should be possible using&amp;nbsp;&lt;EM&gt;&lt;A title="API reference of AGSCredential" href="https://developers.arcgis.com/ios/api-reference/interface_a_g_s_credential.html" target="_blank" rel="noopener"&gt;AGSCredential&lt;/A&gt;&lt;/EM&gt;. We may need specific context to better help you, but here are some general examples&lt;/P&gt;&lt;P&gt;- Use&amp;nbsp;&lt;EM&gt;AGSAuthenticationManagerDelegate&lt;/EM&gt; to catch the authentication challenge and pass in your credentials:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Layers/Display%20subtype%20feature%20layer/DisplaySubtypeFeatureLayerViewController.swift#L134-L138" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Layers/Display%20subtype%20feature%20layer/DisplaySubtypeFeatureLayerViewController.swift#L134-L138&lt;/A&gt;&amp;nbsp;. Don't forget to set&amp;nbsp;&lt;EM&gt;AGSAuthenticationManager.shared().delegate&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;- If you are using an&amp;nbsp;&lt;EM&gt;AGSServiceGeodatabase&lt;/EM&gt;, you can directly set the credentials on it:&amp;nbsp;&lt;A href="https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Edit%20data/Edit%20with%20branch%20versioning/EditWithBranchVersioningViewController.swift#L98" target="_blank" rel="noopener"&gt;https://github.com/Esri/arcgis-runtime-samples-ios/blob/main/arcgis-ios-sdk-samples/Edit%20data/Edit%20with%20branch%20versioning/EditWithBranchVersioningViewController.swift#L98&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Though it is not recommended to hardcode your credentials in code due to security concerns. Proceed with caution if you understand the usecase clearly.&lt;/P&gt;&lt;P&gt;Hope it helps!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 04:04:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100633#M7112</guid>
      <dc:creator>Ting</dc:creator>
      <dc:date>2021-09-22T04:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to enter credentials in code?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100757#M7114</link>
      <description>&lt;P&gt;Hi Ting,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for that. AGSAuthenticationManagerDelegate was exactly what I needed!&lt;/P&gt;&lt;P&gt;And thanks for the tip on the hard coding - I probably should have been more specific. I'll be collecting the username/password through another request and using that - so no hardcoding &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks so much again for your quick and correct response.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 12:25:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1100757#M7114</guid>
      <dc:creator>ThomasKellough</dc:creator>
      <dc:date>2021-09-22T12:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to enter credentials in code?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1101027#M7116</link>
      <description>&lt;P&gt;Note also that you can lean on the keychain to reduce the frequency with which users will be asked to log in. You can look at &lt;A href="https://developers.arcgis.com/ios/api-reference/interface_a_g_s_authentication_manager.html#acf11285e729290bb71b68685f32c0c24" target="_self"&gt;&lt;STRONG&gt;AGSAuthenticationManager.shared.credentialCache&lt;/STRONG&gt;&lt;/A&gt; and call &lt;A href="https://developers.arcgis.com/ios/api-reference/interface_a_g_s_credential_cache.html#ae51a54ec9742174990e7f56744aef329" target="_self"&gt;&lt;STRONG&gt;enableAutoSyncToKeychain()&lt;/STRONG&gt;&lt;/A&gt;. This will securely cache credentials in the keychain, ready for your user to use next time they open the app.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 21:13:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1101027#M7116</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2021-09-22T21:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to enter credentials in code?</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1101037#M7117</link>
      <description>&lt;P&gt;Thank you for that tip! That will definitely help out.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Sep 2021 21:29:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/is-it-possible-to-enter-credentials-in-code/m-p/1101037#M7117</guid>
      <dc:creator>ThomasKellough</dc:creator>
      <dc:date>2021-09-22T21:29:31Z</dc:date>
    </item>
  </channel>
</rss>

