<?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 SDK saved access token fails in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183363#M7623</link>
    <description>&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p3"&gt;&lt;SPAN class="s3"&gt;Thanks James. You shouldn't call&amp;nbsp;authenticateDropboxLogin or authenticationSuccessful or&amp;nbsp;finishAuthentication&amp;nbsp;when you already have an access token. The access token is all you need to access the account. That is, once you have your&amp;nbsp;DropboxAPI object using the retrieved access token, you can start making API calls with it.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 14 May 2016 03:00:18 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2016-05-14T03:00:18Z</dc:date>
    <item>
      <title>Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183358#M7618</link>
      <description>&lt;P&gt;When I authenticate my application using OAuth2 method it works fine and I am able to save the token. However, when I reopen the application and try to use the saved token, the authentication always fails. I checked and the token that is created is the same as the one gets saved.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas what might be the issue?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:33:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183358#M7618</guid>
      <dc:creator>james b.91</dc:creator>
      <dc:date>2019-05-29T09:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183359#M7619</link>
      <description>&lt;P&gt;Can you share a sample failing request and response? (Redact part of the access token to be safe though.)&lt;/P&gt;
&lt;P&gt;If you're using the OAuth 2 "code" flow, one thing we sometimes see is that the app saves the authorization code instead of the access token. The access token is re-usable, but the authorization code isn't. (The authorization code is the string that you get first and then exchange for an access token.)&lt;/P&gt;</description>
      <pubDate>Fri, 13 May 2016 23:44:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183359#M7619</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-05-13T23:44:19Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183360#M7620</link>
      <description>&lt;P&gt;Here is my code. The issue is coming from the&amp;nbsp;authenticationSuccessful failing after I create a new&amp;nbsp;AndroidAuthSession with the previous access token.&lt;/P&gt;
&lt;PRE&gt;// create the application key token&lt;BR /&gt;AppKeyPair appKeyToken = new AppKeyPair("APP Key", "APP Secret");&lt;BR /&gt;AndroidAuthSession session = new AndroidAuthSession(appKeyToken);&lt;BR /&gt;&lt;BR /&gt;// try to get the session token from the shared preferences&lt;BR /&gt;String accessToken = getDropboxToken();&lt;BR /&gt;&lt;BR /&gt;// check if the session token was retrieved&lt;BR /&gt;if (accessToken == null)&lt;BR /&gt; {&lt;BR /&gt; // if no token, then have the user sign in&lt;BR /&gt; dropboxSession = new DropboxAPI&amp;lt;&amp;gt;(session);&lt;BR /&gt; dropboxSession.getSession().startOAuth2Authentication(context);&lt;BR /&gt; }&lt;BR /&gt;else&lt;BR /&gt; {&lt;BR /&gt; // session token already available&lt;BR /&gt; dropboxSession = new DropboxAPI&amp;lt;&amp;gt;(new AndroidAuthSession(appKeyToken,accessToken));&lt;BR /&gt;&lt;BR /&gt; // authenticate Dropbox login&lt;BR /&gt; authenticateDropboxLogin();&lt;BR /&gt; }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;private String getDropboxToken()&lt;BR /&gt;   {&lt;BR /&gt;      // get the shared preferences area for the token&lt;BR /&gt;      SharedPreferences sessionTokenRecord = context.getSharedPreferences("token", Context.MODE_PRIVATE);&lt;BR /&gt;&lt;BR /&gt;      // get the token key&lt;BR /&gt;      String sessionToken = sessionTokenRecord.getString("accessToken", null);&lt;BR /&gt;&lt;BR /&gt;      return sessionToken;&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;private void saveDropboxToken(String accessToken)&lt;BR /&gt;   {&lt;BR /&gt;      // create a new shared preferences area for the token&lt;BR /&gt;      SharedPreferences.Editor tokenRecordEditor = context.getSharedPreferences("token", Context.MODE_PRIVATE).edit();&lt;BR /&gt;&lt;BR /&gt;      tokenRecordEditor.putString("accessToken", accessToken);&lt;BR /&gt;&lt;BR /&gt;      tokenRecordEditor.commit();&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;private void authenticateDropboxLogin()&lt;BR /&gt;   {&lt;BR /&gt;      // check if the authentication was successful&lt;BR /&gt;      if (dropboxSession.getSession().authenticationSuccessful())&lt;BR /&gt;         {&lt;BR /&gt;            // finish the authentication&lt;BR /&gt;            try&lt;BR /&gt;               {&lt;BR /&gt;                  dropboxSession.getSession().finishAuthentication();&lt;BR /&gt;                  saveDropboxToken(dropboxSession.getSession().getOAuth2AccessToken());&lt;BR /&gt;               }&lt;BR /&gt;            catch (IllegalStateException e)&lt;BR /&gt;               {&lt;BR /&gt;                  showToast("Couldn't authenticate with Dropbox:" + e.getLocalizedMessage());&lt;BR /&gt;                  Log.i("Dropbox", "Error authenticating", e);&lt;BR /&gt;               }&lt;BR /&gt;         }&lt;BR /&gt;   }&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 May 2016 01:23:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183360#M7620</guid>
      <dc:creator>james b.91</dc:creator>
      <dc:date>2016-05-14T01:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183361#M7621</link>
      <description>&lt;P&gt;Can you also share the exception/stack trace?&amp;nbsp;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2016 01:25:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183361#M7621</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-05-14T01:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183362#M7622</link>
      <description>&lt;P&gt;That's the thing, there is not a stack trace/exception from building the new AndroidAuthSession, the authenticationSucessful() just returns false and finishAuthenication is never called. If I force the finishAuthentication to be called then it just says "Authentication Failed", but nothing else.&lt;/P&gt;
&lt;P&gt;Also, this issue only occurs when the application is killed and reopened. If the application is paused and resumed then it works just fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2016 01:35:20 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183362#M7622</guid>
      <dc:creator>james b.91</dc:creator>
      <dc:date>2016-05-14T01:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183363#M7623</link>
      <description>&lt;P class="p1"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="p3"&gt;&lt;SPAN class="s3"&gt;Thanks James. You shouldn't call&amp;nbsp;authenticateDropboxLogin or authenticationSuccessful or&amp;nbsp;finishAuthentication&amp;nbsp;when you already have an access token. The access token is all you need to access the account. That is, once you have your&amp;nbsp;DropboxAPI object using the retrieved access token, you can start making API calls with it.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2016 03:00:18 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183363#M7623</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-05-14T03:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Android SDK saved access token fails</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183364#M7624</link>
      <description>&lt;P&gt;Now everything works perfectly, thank you very much! &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; I'm not sure why I thought you needed to have those extra steps with the access token.&lt;/P&gt;</description>
      <pubDate>Sat, 14 May 2016 03:25:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Android-SDK-saved-access-token-fails/m-p/183364#M7624</guid>
      <dc:creator>james b.91</dc:creator>
      <dc:date>2016-05-14T03:25:38Z</dc:date>
    </item>
  </channel>
</rss>

