<?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: OAuthLoginManager in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630399#M4346</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gunther,  I am able to follow what you are saying on steps 1 and 2 in&lt;/P&gt;&lt;P&gt;your response.  A couple of questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.  The code that needs to be added to the AndroidManifest.xml.  Wouldn't I&lt;/P&gt;&lt;P&gt;just add in *&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 May 2019 20:00:31 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2019-05-14T20:00:31Z</dc:date>
    <item>
      <title>OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630397#M4344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to update our application to 100.5 from 10.2.9.&amp;nbsp; I am trying to authenticate the application and have an application setup for the application in our AGOL Organization with a client id and redirect uri.&amp;nbsp; Am running into issues using&amp;nbsp;&lt;SPAN&gt;OAuthLoginManager when I run&amp;nbsp;oAuthLoginManager.launchOAuthBrowserPage(context); I get the message...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please copy this code, switch to your application and paste it there.&amp;nbsp; Struggling to find a good example that describes this.&amp;nbsp; Also strange that it opens up Chrome rather than opening within the app as it did with 10.2.9.&amp;nbsp; Any guidance in the right direction greatly appreciated.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="447384" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/447384_pastedImage_13.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;private OAuthManagement() {&lt;/P&gt;&lt;P&gt;final int OAUTH_EXPIRATION_NEVER = -1;&lt;BR /&gt; oAuthLoginManager = new OAuthLoginManager("https://arcgis.com", "YOUR_CLIENT_ID", "urn:ietf:wg:oauth:2.0:oob", &lt;SPAN&gt;OAUTH_EXPIRATION_NEVER&lt;/SPAN&gt;);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;public void LaunchLogin(Context context) {&lt;BR /&gt; oAuthLoginManager.launchOAuthBrowserPage(context);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;public void handleTokenCredential(Intent intent) {&lt;BR /&gt; portal = new Portal("https://www.arcgis.com", true);&lt;BR /&gt; ListenableFuture&amp;lt;OAuthTokenCredential&amp;gt; futureToken = oAuthLoginManager.fetchOAuthTokenCredentialAsync(intent);&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt; OAuthTokenCredential oAuthTokenCredential = futureToken.get();&lt;BR /&gt; portal.setCredential(oAuthTokenCredential);&lt;BR /&gt; portal.loadAsync();&lt;BR /&gt; portal.addDoneLoadingListener(new Runnable() {&lt;BR /&gt; @Override&lt;BR /&gt; public void run() {&lt;BR /&gt; if(portal.getLoadStatus() == LoadStatus.LOADED) {&lt;BR /&gt; ArcGISRuntimeEnvironment.setLicense(portal.getPortalInfo().getLicenseInfo());&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;} catch (InterruptedException e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; } catch (ExecutionException e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 May 2019 20:15:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630397#M4344</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-10T20:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630398#M4345</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suggest you use our DefaultAuthenticationChallengeHandler to implement authentication with the portal.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/DefaultAuthenticationChallengeHandler.html" rel="nofollow noopener noreferrer" target="_blank"&gt;https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/DefaultAuthenticationChallengeHandler.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to authenticate via OAuth you have to implement the following steps:&lt;/P&gt;&lt;P&gt;1. S&lt;SPAN style="color: #474747; background-color: #ffffff;"&gt;et the&amp;nbsp; &lt;SPAN style="color: #3d3d3d;"&gt;DefaultAuthenticationChallengeHandler&amp;nbsp;&lt;/SPAN&gt;on the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/AuthenticationManager.html" style="color: #0079c1; background-color: #ffffff; text-decoration: none;" title="class in com.esri.arcgisruntime.security" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;CODE&gt;AuthenticationManager&lt;/CODE&gt;&lt;/A&gt;&lt;SPAN style="color: #474747; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;by calling&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/AuthenticationManager.html#setAuthenticationChallengeHandler(com.esri.arcgisruntime.security.AuthenticationChallengeHandler)" style="color: #0079c1; background-color: #ffffff; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;CODE&gt;AuthenticationManager.setAuthenticationChallengeHandler(authenticationChallengeHandler)&lt;/CODE&gt;&lt;/A&gt;&lt;SPAN style="color: #474747; background-color: #ffffff;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #474747; background-color: #ffffff;"&gt;2. Add an OAuth configuration to the AuthenticationManager with&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/AuthenticationManager.html#addOAuthConfiguration(com.esri.arcgisruntime.security.OAuthConfiguration)" style="color: #0079c1; background-color: #ffffff; text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;&lt;CODE&gt;AuthenticationManager.addOAuthConfiguration(OAuthConfiguration)&lt;/CODE&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #474747; background-color: #ffffff;"&gt;3. Handle the apps redirect URI with the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;CODE&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/DefaultOAuthIntentReceiver.html" style="color: #0079c1; background-color: #ffffff; text-decoration: none;" title="class in com.esri.arcgisruntime.security" rel="nofollow noopener noreferrer" target="_blank"&gt;DefaultOAuthIntentReceiver,&amp;nbsp;&lt;/A&gt;&lt;/CODE&gt;&lt;SPAN style="color: #000000;"&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/DefaultOAuthIntentReceiver.html" style="color: #000000;" title="class in com.esri.arcgisruntime.security" rel="nofollow noopener noreferrer" target="_blank"&gt;which needs to be added to your manifest:&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&amp;lt;activity
   android:name="com.esri.arcgisruntime.security.DefaultOAuthIntentReceiver"
   android:launchMode="singleTask"
   android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
   android:label="YourLabel"&amp;gt;
   &amp;lt;intent-filter&amp;gt;
     &amp;lt;action android:name="android.intent.action.VIEW"/&amp;gt;
     &amp;lt;category android:name="android.intent.category.DEFAULT"/&amp;gt;
     &amp;lt;category android:name="android.intent.category.BROWSABLE"/&amp;gt;
     &amp;lt;data android:scheme="your-redirect-URI"/&amp;gt;
   &amp;lt;/intent-filter&amp;gt;
 &amp;lt;/activity&amp;gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Note that the&amp;nbsp;&lt;SPAN style="color: #3d3d3d;"&gt;DefaultAuthenticationChallengeHandler will always use a device-installed browser window to prompt users for credentials instead of prompting within the application, which is in line with&amp;nbsp;the OAuth security guidelines.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN&gt;Unfortunately we don't have a sample of this published yet, but we are working on it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Gunther&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630398#M4345</guid>
      <dc:creator>GuntherHeppner</dc:creator>
      <dc:date>2021-12-12T02:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630399#M4346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gunther,  I am able to follow what you are saying on steps 1 and 2 in&lt;/P&gt;&lt;P&gt;your response.  A couple of questions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.  The code that needs to be added to the AndroidManifest.xml.  Wouldn't I&lt;/P&gt;&lt;P&gt;just add in *&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2019 20:00:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630399#M4346</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-14T20:00:31Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630400#M4347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gunther, Tried to respond via email and it look like it cut off what I wrote...below is my reply...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #222222; background-color: #ffffff; font-size: small;"&gt;Hi Gunther,&amp;nbsp; I am able to follow what you are saying on steps 1 and 2 in your response.&amp;nbsp; A couple of questions.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;1.&amp;nbsp; The code that needs to be added to the AndroidManifest.xml.&amp;nbsp; Wouldn't I just add in&amp;nbsp;&lt;SPAN style="color: #666666; font-size: 14px;"&gt;&amp;lt;data android:scheme="&lt;/SPAN&gt;urn:ietf:wg:oauth:2.0:oob&amp;nbsp;&lt;SPAN style="color: #666666; font-size: 14px;"&gt;"/&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&amp;nbsp;to an existing activity where I am handling as below or is there some other things going on in ...?&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;/DIV&gt;&lt;DIV style="color: #222222; background-color: #ffffff; font-size: small;"&gt;&lt;DIV&gt;AuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(this);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;AuthenticationManager.setAuthenticationChallengeHandler(handler);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;OAuthConfiguration oAC = new OAuthConfiguration(urlLogin, Client_ID, "urn:ietf:wg:oauth:2.0:oob", OAUTH_EXPIRATION_NEVER);&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;AuthenticationManager.addOAuthConfiguration(oAC);&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;2.&amp;nbsp; Don't really understand how I am supposed to launch the login page.&amp;nbsp; With OauthLoginManager I use this...&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;oAuthLoginManager.launchOAuthBrowserPage(getApplicationContext());&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I launch the login with AuthenticationManager?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;3.&amp;nbsp; Will this method produce a credential?&amp;nbsp; I want to avoid the user having to login every time they open up the application.&amp;nbsp; In 10.2.9 we were storing and encrypting AGOL credentials on the device.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2019 21:09:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630400#M4347</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-14T21:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630401#M4348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The&amp;nbsp;DefaultOAuthIntentReceiver is an activity provided by the SDK for you. You just need to add it to your manifest so it can handle redirect intents from the browser. You don't need to handle the intents from the browser in your own activity.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. You don't need to launch the login page by yourself, the SDK will do that for you as soon as you load your Portal instance. As soon as you call&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;portal.loadAsync() you should get prompted for credentials. That means you don't need to set a credential on the Portal instance before you load it.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;3. Once the user has provided the correct username and password in the login page, a credential will be set on the Portal instance.&amp;nbsp;The SDK also&amp;nbsp;caches&amp;nbsp;this credential in the AuthenticationManager.CredentialCache. You can persist this cache to json and restore it later on. Encrypting the stored credentials is something you need to take care of, just like in 10.2.9.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/AuthenticationManager.CredentialCache.html"&gt;https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/security/AuthenticationManager.CredentialCache.html&lt;/A&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 10:51:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630401#M4348</guid>
      <dc:creator>GuntherHeppner</dc:creator>
      <dc:date>2019-05-15T10:51:21Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630402#M4349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gunther,&amp;nbsp; All of that makes sense.&amp;nbsp; Have initiated the way you describe and for whatever reason am not seeing a login prompt...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AndroidManifest.xml&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;activity&lt;BR /&gt; android:name="com.esri.arcgisruntime.security.DefaultOAuthIntentReceiver"&lt;BR /&gt; android:launchMode="singleTask"&lt;BR /&gt; android:configChanges="keyboard|keyboardHidden|orientation|screenSize"&lt;BR /&gt; android:label="YourLabel"&amp;gt;&lt;BR /&gt; &amp;lt;intent-filter&amp;gt;&lt;BR /&gt; &amp;lt;action android:name="android.intent.action.VIEW"/&amp;gt;&lt;BR /&gt; &amp;lt;category android:name="android.intent.category.DEFAULT"/&amp;gt;&lt;BR /&gt; &amp;lt;category android:name="android.intent.category.BROWSABLE"/&amp;gt;&lt;BR /&gt; &amp;lt;data android:scheme="urn:ietf:wg:oauth:2.0:oob"/&amp;gt;&lt;BR /&gt; &amp;lt;/intent-filter&amp;gt;&lt;BR /&gt; &amp;lt;/activity&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Function from OnCreate of Launcher Activity&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;String urlLogin = getResources().getString(R.string.portal_url);&lt;/P&gt;&lt;P&gt;try {&lt;BR /&gt; AuthenticationChallengeHandler handler = new DefaultAuthenticationChallengeHandler(this);&lt;BR /&gt; OAuthConfiguration oAC = new OAuthConfiguration(urlLogin, Client_ID2, "urn:ietf:wg:oauth:2.0:oob", OAUTH_EXPIRATION_NEVER);&lt;BR /&gt; AuthenticationManager.addOAuthConfiguration(oAC);&lt;BR /&gt; AuthenticationManager.setAuthenticationChallengeHandler(handler);&lt;/P&gt;&lt;P&gt;} catch (MalformedURLException e) {&lt;BR /&gt; throw new AssertionError(e);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// create a portal to ArcGIS Online&lt;BR /&gt; Portal portal = new Portal(urlLogin);&lt;BR /&gt; &lt;BR /&gt; portal.addDoneLoadingListener(new Runnable() {&lt;BR /&gt; @Override&lt;BR /&gt; public void run() {&lt;BR /&gt; if (portal.getLoadStatus() == LoadStatus.LOADED) {&lt;BR /&gt; // loaded&lt;BR /&gt; //String x = portal.getUser().getFullName();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;portal.loadAsync();&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 18:17:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630402#M4349</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-15T18:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630403#M4350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gunther, OK my bad on this. Neglected to set loginRequired to "true" on Portal..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Portal portal = new Portal(urlLogin, true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That code above works to prompt login once that is done.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 19:31:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630403#M4350</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-15T19:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630404#M4351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gunther, OK am back to the same issue as with the other method.&amp;nbsp; Get this after I login with AGOL credentials.&amp;nbsp; Tried several organizations I have membership to, but got the same results every time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/447709_pastedImage_1.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 19:43:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630404#M4351</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-15T19:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630405#M4352</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting the "loginRequired" flag to true when constructing the Portal is the right way to do it. Otherwise, if your Portal allows anonymous login, it won't prompt upon loading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Glad you could make it work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gunther&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 19:46:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630405#M4352</guid>
      <dc:creator>GuntherHeppner</dc:creator>
      <dc:date>2019-05-15T19:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630406#M4353</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also added in code for onResume when back in the application that portal (which I am making an activity level variable) does not return the credential after username and password have been entered in triggered by&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;portal.loadAsync();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in onResume after return to app&lt;/P&gt;&lt;P&gt;portal.getCredential() returns null.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2019 20:01:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630406#M4353</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-15T20:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630407#M4354</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You should use a custom &lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;redirect_uri instead of the known uri "&lt;SPAN style="color: #3d3d3d; background-color: #ffffff;"&gt;&lt;STRONG&gt;urn:ietf:wg:oauth:2.0:oob&lt;/STRONG&gt;" in your Android app.&amp;nbsp;&lt;SPAN style="color: #4c4c4c;"&gt;In order to allow the browser to redirect the user back to your&amp;nbsp;app after they authorize your&amp;nbsp;app you need to setup a custom redirect_uri.&lt;SPAN&gt;&amp;nbsp;An example of a custom redirect_uri is "&lt;STRONG&gt;my-arcgis-app://auth&lt;/STRONG&gt;". The following changes are needed. Before making these changes, you need to add the custom&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;redirect_uri to your application on ArcGIS Online or your on-premise portal. More info about configuring a redirect URI can be found at &lt;A href="https://developers.arcgis.com/documentation/core-concepts/security-and-authentication/mobile-and-native-user-logins/#configure-a-redirect-uri"&gt;this guide doc&lt;/A&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;1. Modify the&amp;nbsp;&lt;SPAN&gt;intent-filter in&amp;nbsp;the&amp;nbsp;&lt;STRONG style="background-color: #ffffff; border: 0px; font-weight: bold;"&gt;AndroidManifest.xml:&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;change &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;lt;data android:scheme="&lt;STRONG&gt;urn:ietf:wg:oauth:2.0:oob&lt;/STRONG&gt;"/&amp;gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;to&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&amp;lt;data android:host=“&lt;STRONG&gt;auth&lt;/STRONG&gt;” android:scheme=“&lt;STRONG&gt;my-arcgis-app&lt;/STRONG&gt;”/&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;2. Modify the redirectUri parameter passed to the&amp;nbsp;&lt;SPAN&gt;OAuthConfiguration:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;change&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;OAuthConfiguration oAC = new OAuthConfiguration(urlLogin, Client_ID2, "&lt;STRONG&gt;urn:ietf:wg:oauth:2.0:oob&lt;/STRONG&gt;", OAUTH_EXPIRATION_NEVER);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;to&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;OAuthConfiguration oAC = new OAuthConfiguration(urlLogin, Client_ID2, "&lt;STRONG style="color: #4c4c4c; background-color: #ffffff;"&gt;my-arcgis-app://auth&lt;/STRONG&gt;", OAUTH_EXPIRATION_NEVER);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xueming&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2019 00:41:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630407#M4354</guid>
      <dc:creator>XuemingWu</dc:creator>
      <dc:date>2019-05-16T00:41:39Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630408#M4355</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Xueming!&amp;nbsp; That worked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A follow up question.&amp;nbsp; So a question after login is successful and back in portal listener...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;portal&lt;/SPAN&gt;.getCredential() returns a regular Credential

Is there anyway to pull an OAuthTokenCredential from the AuthenticationManager after login?  
Cannot seem to find a good example of this.&lt;/PRE&gt;&lt;P&gt;The reason we need an OAuthTokenCredential is that in the app we have the ability to download TPK files and in order to download I follow this pattern using the token to do a stock Android download...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;String token = &lt;SPAN style="color: #660e7a;"&gt;mOauthToken&lt;/SPAN&gt;.getAccessToken();
requestUrl = portal.getUri() + &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"/sharing/rest/content/items/" &lt;/SPAN&gt;+ &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;itemID &lt;/SPAN&gt;+ &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"/data?token=" &lt;/SPAN&gt;+ token;
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;URL url = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;URL(requestUrl);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();

&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;Seems like something like this might work alternatively....but am struggling to figure out how to create an authorizationCode&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;OAuthTokenCredentialRequest request = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;OAuthTokenCredentialRequest(&lt;SPAN style="color: #660e7a;"&gt;finalURLLogin&lt;/SPAN&gt;, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;null&lt;/SPAN&gt;, &lt;SPAN style="color: #660e7a;"&gt;Client_ID2&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"my-arcgis-app://auth"&lt;/SPAN&gt;, authorizationCode);&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:49:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630408#M4355</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T02:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630409#M4356</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are very welcome.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't need to pull the credential from AuthenticationManager. When you access a portal with OAuth, the credential comes back should be an instance of OAuthTokenCredential, meaning you can cast it to an&amp;nbsp;&lt;SPAN&gt;OAuthTokenCredential like the following:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OAuthTokenCredential credential = ((OAuthTokenCredential) portal.getCredential());&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;downloading TPK files from a portal, our SDK provides another option which is a class called &lt;A href="https://developers.arcgis.com/android/latest/api-reference/reference/com/esri/arcgisruntime/io/ArcGISDownloadRequest.html"&gt;ArcGISDownloadRequest&lt;/A&gt;. This class extends Android's DownloadManager.Request and works with token-based and OAuth authentication. You can&amp;nbsp;create a Request by calling:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;ArcGISDownloadRequest.createInstance(&lt;/SPAN&gt;portal.getUri() + &lt;SPAN style="color: #008000; border: 0px; font-weight: bold; font-size: 12px;"&gt;"/sharing/rest/content/items/" &lt;/SPAN&gt;+ &lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;itemID &lt;/SPAN&gt;+ &lt;SPAN style="color: #008000; border: 0px; font-weight: bold; font-size: 12px;"&gt;"/data");&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;As you already use the&amp;nbsp;&lt;SPAN&gt;DefaultAuthenticationChallengeHandler to deal with authentication in your app, it is&amp;nbsp;unnecessary to use OAuthTokenCredentialRequest to obtain credential. Though the DefaultAuthenticationChallengeHandler also calls&amp;nbsp;OAuthTokenCredentialRequest, there are a few more steps to get the authorization code, launch the sign in page in a browser and then obtain the credential. The&amp;nbsp;DefaultAuthenticationChallengeHandler takes case all the details and is the recommended approach for our users.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;Xueming&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 May 2019 22:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630409#M4356</guid>
      <dc:creator>XuemingWu</dc:creator>
      <dc:date>2019-05-16T22:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630410#M4357</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Xueming, Thank you for that quick tip.&amp;nbsp; Should have thought about casting the credential.&amp;nbsp; For everyone else's benefit below is a summary of how to get your app authenticated and create a credential for further use in your application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; In you application in AGOL add in a new redirect uri as follows...&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;"&lt;/SPAN&gt;&lt;STRONG style="color: #4c4c4c; background-color: #ffffff; border: 0px; font-weight: bold;"&gt;my-arcgis-app://auth&lt;/STRONG&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #4c4c4c; background-color: #ffffff;"&gt;2.&amp;nbsp; In you Android Manifest add in the following...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;activity
&lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:name=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"com.esri.arcgisruntime.security.DefaultOAuthIntentReceiver"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:launchMode=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"singleTask"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:configChanges=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"keyboard|keyboardHidden|orientation|screenSize"
&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;    &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:label=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"YourLabel"&lt;/SPAN&gt;&amp;gt;
    &amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;intent-filter&lt;/SPAN&gt;&amp;gt;
        &amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;action &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:name=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"android.intent.action.VIEW"&lt;/SPAN&gt;/&amp;gt;
        &amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;category &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:name=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"android.intent.category.DEFAULT"&lt;/SPAN&gt;/&amp;gt;
        &amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;category &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:name=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"android.intent.category.BROWSABLE"&lt;/SPAN&gt;/&amp;gt;
        &amp;lt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;data &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;android&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-weight: bold;"&gt;:scheme=&lt;/SPAN&gt;&lt;SPAN style="color: #008000; font-weight: bold;"&gt;"my-arcgis-app"&lt;/SPAN&gt;/&amp;gt;
    &amp;lt;/&lt;SPAN style="color: #000080; font-weight: bold;"&gt;intent-filter&lt;/SPAN&gt;&amp;gt;
&amp;lt;/&lt;SPAN style="color: #000080; font-weight: bold;"&gt;activity&lt;/SPAN&gt;&amp;gt;

3.  In onCreate of your Activity...Note that client id also is known from you application in AGOL

&lt;PRE class="lia-code-sample line-numbers language-none"&gt;String urlLogin = "https://www.arcgis.com";&lt;/PRE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;  &amp;nbsp;int &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;OAUTH_EXPIRATION_NEVER &lt;/SPAN&gt;= -&lt;SPAN style="color: #0000ff;"&gt;1&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;AuthenticationChallengeHandler handler = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;DefaultAuthenticationChallengeHandler(&lt;SPAN style="color: #660e7a;"&gt;this&lt;/SPAN&gt;);&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;final &lt;/SPAN&gt;OAuthConfiguration oAC = &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;OAuthConfiguration(urlLogin, &lt;SPAN style="color: #660e7a;"&gt;Client_ID&lt;/SPAN&gt;, &lt;SPAN style="color: #008000; font-weight: bold;"&gt;"my-arcgis-app://auth"&lt;/SPAN&gt;, &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;OAUTH_EXPIRATION_NEVER&lt;/SPAN&gt;);&lt;BR /&gt; AuthenticationManager.&lt;SPAN&gt;addOAuthConfiguration&lt;/SPAN&gt;(oAC);&lt;BR /&gt; AuthenticationManager.&lt;SPAN&gt;setAuthenticationChallengeHandler&lt;/SPAN&gt;(handler);&lt;BR /&gt;} &lt;SPAN style="color: #000080; font-weight: bold;"&gt;catch &lt;/SPAN&gt;(MalformedURLException e) {&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;//String x = e.getMessage();&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;throw new &lt;/SPAN&gt;AssertionError(e);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #808080;"&gt;// create a portal to ArcGIS Online&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;portal &lt;/SPAN&gt;= &lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Portal(urlLogin, &lt;SPAN style="color: #000080; font-weight: bold;"&gt;true&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;portal&lt;/SPAN&gt;.addDoneLoadingListener(&lt;SPAN style="color: #000080; font-weight: bold;"&gt;new &lt;/SPAN&gt;Runnable() {&lt;BR /&gt; &lt;SPAN style="color: #808000;"&gt;@Override&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808000;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; font-weight: bold;"&gt;public void &lt;/SPAN&gt;run() {&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;try &lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN style="color: #000080; font-weight: bold;"&gt;if &lt;/SPAN&gt;(&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;portal&lt;/SPAN&gt;.getLoadStatus() == LoadStatus.&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;LOADED&lt;/SPAN&gt;) {&lt;BR /&gt; &lt;SPAN style="color: #808080;"&gt;// loaded&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; // get the authorization code by sending user to the authorization screen&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt; OAuthTokenCredential &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;mValidLoginCredentials &lt;/SPAN&gt;= (OAuthTokenCredential) &lt;SPAN style="color: #660e7a; font-weight: bold;"&gt;portal&lt;/SPAN&gt;.getCredential();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt; } &lt;SPAN style="color: #000080; font-weight: bold;"&gt;catch &lt;/SPAN&gt;(Exception e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt;});&lt;/PRE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:49:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630410#M4357</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T02:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630411#M4358</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Argh forgot an important detail...&lt;SPAN style="background-color: #ffffff;"&gt;portal.loadAsync(); is what initiates portal and request for creds...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt;// create a portal to ArcGIS Online
&lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;portal &lt;/SPAN&gt;= &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;new &lt;/SPAN&gt;Portal(urlLogin, &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;true&lt;/SPAN&gt;);

&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;portal&lt;/SPAN&gt;.addDoneLoadingListener(&lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;new &lt;/SPAN&gt;Runnable() {
 &lt;SPAN style="color: #808000; border: 0px; font-weight: inherit; font-size: 12px;"&gt;@Override
&lt;/SPAN&gt;&lt;SPAN style="color: #808000; border: 0px; font-weight: inherit; font-size: 12px;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;public void &lt;/SPAN&gt;run() {
 &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;try &lt;/SPAN&gt;{
 &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;if &lt;/SPAN&gt;(&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;portal&lt;/SPAN&gt;.getLoadStatus() == LoadStatus.&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;LOADED&lt;/SPAN&gt;) {
 &lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt;// loaded
&lt;/SPAN&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt; // get the authorization code by sending user to the authorization screen
&lt;/SPAN&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 12px;"&gt; OAuthTokenCredential &lt;/SPAN&gt;&lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;mValidLoginCredentials &lt;/SPAN&gt;= (OAuthTokenCredential) &lt;SPAN style="color: #660e7a; border: 0px; font-weight: bold; font-size: 12px;"&gt;portal&lt;/SPAN&gt;.getCredential();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
 } &lt;SPAN style="color: #000080; border: 0px; font-weight: bold; font-size: 12px;"&gt;catch &lt;/SPAN&gt;(Exception e) {
 e.printStackTrace();
 }
 }
});&lt;/PRE&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; "&gt;portal.loadAsync();&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:49:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630411#M4358</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-12T02:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630412#M4359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK one other comment on this method for login.&amp;nbsp; When using this method the default browser is used for login.&amp;nbsp; The unfortunate consequence is that each time you login a new tab is opened in your internet browser on your device (in my case Chrome).&amp;nbsp; When I later access Chrome Browser I see a tab for each time I logged in with credentials still in there.&amp;nbsp; Is there a built in way to close the browser tab after done?&amp;nbsp; I can see this being a problem in the production environment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2019 15:49:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630412#M4359</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2019-05-17T15:49:40Z</dc:date>
    </item>
    <item>
      <title>Re: OAuthLoginManager</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630413#M4360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Aaron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a&amp;nbsp;bug we are aware of and currently trying to fix. We are not aware of any workaround.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Gunther&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 May 2019 15:55:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/oauthloginmanager/m-p/630413#M4360</guid>
      <dc:creator>GuntherHeppner</dc:creator>
      <dc:date>2019-05-17T15:55:33Z</dc:date>
    </item>
  </channel>
</rss>

