<?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 Handle token expiry in AuthenticationChallengeHandler in Kotlin Maps SDK Questions</title>
    <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/handle-token-expiry-in/m-p/1312509#M176</link>
    <description>&lt;P&gt;When authenticating using Oauth in Android using arcgis maps sdk (kotlin) , we have defined the authenticationchallegehandler to handle oauthcredential challenge like below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ArcGISAuthenticationChallengeHandler &lt;/SPAN&gt;&lt;SPAN&gt;{ &lt;/SPAN&gt;challenge: ArcGISAuthenticationChallenge &lt;SPAN&gt;-&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;oAuthConfiguration = getOAuthConfiguration()&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(oAuthConfiguration != &lt;SPAN&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp; &lt;SPAN&gt;oAuthConfiguration&lt;/SPAN&gt;.canBeUsedForUrl(challenge.&lt;SPAN&gt;requestUrl&lt;/SPAN&gt;)) {&lt;BR /&gt;         &lt;SPAN&gt;val &lt;/SPAN&gt;oAuthUserCredential =&lt;BR /&gt;                OAuthUserCredential.create(&lt;SPAN&gt;oAuthConfiguration&lt;/SPAN&gt;) &lt;SPAN&gt;{ &lt;/SPAN&gt;oAuthUserSignIn &lt;SPAN&gt;-&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;                    loginViewModel?.promptForOAuthUserSignIn(oAuthUserSignIn)&lt;BR /&gt;                &lt;SPAN&gt;}&lt;/SPAN&gt;.&lt;SPAN&gt;getOrThrow&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;            ArcGISEnvironment.&lt;SPAN&gt;authenticationManager&lt;/SPAN&gt;.&lt;SPAN&gt;arcGISCredentialStore&lt;/SPAN&gt;.add(&lt;BR /&gt;                oAuthUserCredential&lt;BR /&gt;            )&lt;BR /&gt;            ArcGISAuthenticationChallengeResponse.ContinueWithCredential(&lt;BR /&gt;                oAuthUserCredential&lt;BR /&gt;            )&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, the user is shown the prompt to signin , in case the user is in the LoginActivity. How do we handle token expiry incase we are in a different activity ? How will we get the token expiry message? Any sample would be much appreciated.&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2023 12:58:59 GMT</pubDate>
    <dc:creator>KrithikaLakshmi</dc:creator>
    <dc:date>2023-07-27T12:58:59Z</dc:date>
    <item>
      <title>Handle token expiry in AuthenticationChallengeHandler</title>
      <link>https://community.esri.com/t5/kotlin-maps-sdk-questions/handle-token-expiry-in/m-p/1312509#M176</link>
      <description>&lt;P&gt;When authenticating using Oauth in Android using arcgis maps sdk (kotlin) , we have defined the authenticationchallegehandler to handle oauthcredential challenge like below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ArcGISAuthenticationChallengeHandler &lt;/SPAN&gt;&lt;SPAN&gt;{ &lt;/SPAN&gt;challenge: ArcGISAuthenticationChallenge &lt;SPAN&gt;-&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;    &lt;SPAN&gt;val &lt;/SPAN&gt;oAuthConfiguration = getOAuthConfiguration()&lt;BR /&gt;    &lt;SPAN&gt;if &lt;/SPAN&gt;(oAuthConfiguration != &lt;SPAN&gt;null &lt;/SPAN&gt;&amp;amp;&amp;amp; &lt;SPAN&gt;oAuthConfiguration&lt;/SPAN&gt;.canBeUsedForUrl(challenge.&lt;SPAN&gt;requestUrl&lt;/SPAN&gt;)) {&lt;BR /&gt;         &lt;SPAN&gt;val &lt;/SPAN&gt;oAuthUserCredential =&lt;BR /&gt;                OAuthUserCredential.create(&lt;SPAN&gt;oAuthConfiguration&lt;/SPAN&gt;) &lt;SPAN&gt;{ &lt;/SPAN&gt;oAuthUserSignIn &lt;SPAN&gt;-&amp;gt;&lt;BR /&gt;&lt;/SPAN&gt;                    loginViewModel?.promptForOAuthUserSignIn(oAuthUserSignIn)&lt;BR /&gt;                &lt;SPAN&gt;}&lt;/SPAN&gt;.&lt;SPAN&gt;getOrThrow&lt;/SPAN&gt;()&lt;BR /&gt;&lt;BR /&gt;            ArcGISEnvironment.&lt;SPAN&gt;authenticationManager&lt;/SPAN&gt;.&lt;SPAN&gt;arcGISCredentialStore&lt;/SPAN&gt;.add(&lt;BR /&gt;                oAuthUserCredential&lt;BR /&gt;            )&lt;BR /&gt;            ArcGISAuthenticationChallengeResponse.ContinueWithCredential(&lt;BR /&gt;                oAuthUserCredential&lt;BR /&gt;            )&lt;BR /&gt;        }&lt;BR /&gt;    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case, the user is shown the prompt to signin , in case the user is in the LoginActivity. How do we handle token expiry incase we are in a different activity ? How will we get the token expiry message? Any sample would be much appreciated.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2023 12:58:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/kotlin-maps-sdk-questions/handle-token-expiry-in/m-p/1312509#M176</guid>
      <dc:creator>KrithikaLakshmi</dc:creator>
      <dc:date>2023-07-27T12:58:59Z</dc:date>
    </item>
  </channel>
</rss>

