<?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: Android - Unable to save the login in my android app in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-Unable-to-save-the-login-in-my-android-app/m-p/321843#M18938</link>
    <description>&lt;P&gt;While access tokens don't expire automatically, users can revoke access tokens at any time.&lt;/P&gt;
&lt;P&gt;You can check if an access token is still currently valid by attempting an API call, such as&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/users/DbxUserUsersRequests.html#getCurrentAccount--" target="_blank"&gt;getCurrentAccount&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If the access token is no longer valid though, it's not possible to get a new one without sending the user through the app authorization flow again.&lt;/P&gt;</description>
    <pubDate>Mon, 07 Jan 2019 15:32:38 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2019-01-07T15:32:38Z</dc:date>
    <item>
      <title>Android - Unable to save the login in my android app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-Unable-to-save-the-login-in-my-android-app/m-p/321640#M18934</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am able to log the&amp;nbsp;user in and retrieve the access token the first time and store it using SharedPreferences. However,&amp;nbsp; I want the users to log in automatically the next time they open my app (retrieve the access token silently).&lt;/P&gt;&lt;P&gt;I can always retrieve the access token stored in the app's local storage (SharedPreferences) but it might not be valid after a few hours/days. Is there a way to check if the access token in the local storage is valid and if not, retrieve a new access token without the user entering their dropbox credentials again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my code for retrieving the access token the first time:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;private void dropboxLogin() {
        System.out.println("First Login");
        Auth.startOAuth2Authentication(MainActivity.this, APP_KEY);&lt;BR /&gt;}

    @Override
    protected void onResume() {
        super.onResume();
        SharedPreferences prefs = getSharedPreferences("dropbox-sample", MODE_PRIVATE);
        String accessToken = prefs.getString("access-token", null);
        if (accessToken == null) {
            accessToken = Auth.getOAuth2Token();
            if (accessToken != null) {
                prefs.edit().putString("access-token", accessToken).apply();
                initAndLoadData(accessToken);
            }
        } else {
            initAndLoadData(accessToken);
        }
        System.out.println("Access Token: " + accessToken);
        String uid = Auth.getUid();
        String storedUid = prefs.getString("user-id", null);
        if (uid != null &amp;amp;&amp;amp; !uid.equals(storedUid)) {
            prefs.edit().putString("user-id", uid).apply();
        }
    }&lt;/PRE&gt;&lt;P&gt;Note that I am using Dropbox API v2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:08:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-Unable-to-save-the-login-in-my-android-app/m-p/321640#M18934</guid>
      <dc:creator>aishwaryapb</dc:creator>
      <dc:date>2019-05-29T09:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Android - Unable to save the login in my android app</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-Unable-to-save-the-login-in-my-android-app/m-p/321843#M18938</link>
      <description>&lt;P&gt;While access tokens don't expire automatically, users can revoke access tokens at any time.&lt;/P&gt;
&lt;P&gt;You can check if an access token is still currently valid by attempting an API call, such as&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v3.0.x/com/dropbox/core/v2/users/DbxUserUsersRequests.html#getCurrentAccount--" target="_blank"&gt;getCurrentAccount&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;If the access token is no longer valid though, it's not possible to get a new one without sending the user through the app authorization flow again.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Jan 2019 15:32:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-Unable-to-save-the-login-in-my-android-app/m-p/321843#M18938</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-01-07T15:32:38Z</dc:date>
    </item>
  </channel>
</rss>

