<?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: Error when using PregeneratedTokenCredential to authenticate services. in Flutter Maps SDK Questions</title>
    <link>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1574971#M39</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/867781"&gt;@locho&lt;/a&gt;&amp;nbsp;- thanks for sending your question through the forum&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hmm I wonder if this could be a timing issue if it's working sometimes and not others. May I ask what is it you are trying to load - a Portal, a type of layer, something else? And are you explicitly calling and awaiting load on whatever it is you are loading? Do you have any repro code from that part of the app?&lt;/P&gt;&lt;P&gt;Thanks - any other info you can provide may assist us in helping figure things out!&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jan 2025 18:12:44 GMT</pubDate>
    <dc:creator>JenMerritt</dc:creator>
    <dc:date>2025-01-13T18:12:44Z</dc:date>
    <item>
      <title>Error when using PregeneratedTokenCredential to authenticate services.</title>
      <link>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1574704#M36</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2025-01-13 at 09.15.27.png" style="width: 711px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/123178i2CDBCBAC52DA3F61/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2025-01-13 at 09.15.27.png" alt="Screenshot 2025-01-13 at 09.15.27.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works unstable, sometimes it authenticates successfully, sometimes it fails.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Log error:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Unhandled Exception: ArcGISException: code=18004; A token or API key is required.; A token or API key was not provided to access&amp;nbsp;&lt;A href="https://arcgis.xyz.vn/arcgis/rest/services/xyz/MapServer/" rel="nofollow" target="_blank"&gt;https://arcgis.xyz.vn/arcgis/rest/services/xyz/MapServer/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 02:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1574704#M36</guid>
      <dc:creator>locho</dc:creator>
      <dc:date>2025-01-13T02:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using PregeneratedTokenCredential to authenticate services.</title>
      <link>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1574971#M39</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/867781"&gt;@locho&lt;/a&gt;&amp;nbsp;- thanks for sending your question through the forum&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Hmm I wonder if this could be a timing issue if it's working sometimes and not others. May I ask what is it you are trying to load - a Portal, a type of layer, something else? And are you explicitly calling and awaiting load on whatever it is you are loading? Do you have any repro code from that part of the app?&lt;/P&gt;&lt;P&gt;Thanks - any other info you can provide may assist us in helping figure things out!&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jan 2025 18:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1574971#M39</guid>
      <dc:creator>JenMerritt</dc:creator>
      <dc:date>2025-01-13T18:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using PregeneratedTokenCredential to authenticate services.</title>
      <link>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1575198#M40</link>
      <description>&lt;P&gt;I have loaded ArcGIS MapImageLayer just like the sample code&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/flutter/sample-code/add-map-image-layer/" target="_blank"&gt;https://developers.arcgis.com/flutter/sample-code/add-map-image-layer/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2025 01:18:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1575198#M40</guid>
      <dc:creator>locho</dc:creator>
      <dc:date>2025-01-14T01:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Error when using PregeneratedTokenCredential to authenticate services.</title>
      <link>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1576306#M44</link>
      <description>&lt;P data-unlink="true"&gt;Actually re-reviewing your code, with the&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/flutter/api-reference/reference/arcgis_maps/PregeneratedTokenCredential-class.html" target="_self"&gt;PregeneratedTokenCredential&lt;/A&gt;, this is slightly different to the &lt;A href="https://developers.arcgis.com/flutter/api-reference/reference/arcgis_maps/TokenCredential-class.html" target="_self"&gt;TokenCredential&lt;/A&gt; workflow. Are you looking to have a user login experience in your app? If so, you can either use the TokenCredential or OAuthUserCredential workflows. For these you need to override the handleArcGISAuthenticationChallenge method.&lt;/SPAN&gt;&lt;/P&gt;&lt;P data-unlink="true"&gt;&lt;SPAN&gt;If you are looking to use a pregenerated token, then this is for the workflow where you are using a token generated outside of your application. i.e. you can just get your pregenerated token and add this to the credential store - you just need to make sure you do this before you load the map or any secured services you are using.&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;ArcGISEnvironment.authenticationManager.arcGISCredentialStore.add(credential: pregeneratedTokenCredential);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2025 09:28:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/flutter-maps-sdk-questions/error-when-using-pregeneratedtokencredential-to/m-p/1576306#M44</guid>
      <dc:creator>JenMerritt</dc:creator>
      <dc:date>2025-01-16T09:28:21Z</dc:date>
    </item>
  </channel>
</rss>

