<?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: DbxCredential Android vs Java in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526924#M25564</link>
    <description>&lt;P&gt;Thanks Greg, that makes sense.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 18:22:49 GMT</pubDate>
    <dc:creator>vewert</dc:creator>
    <dc:date>2021-06-14T18:22:49Z</dc:date>
    <item>
      <title>DbxCredential Android vs Java</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526308#M25544</link>
      <description>&lt;P&gt;I recently updated my Android app to use &lt;SPAN&gt;OAuth code flow with PKCE, with refresh tokens. I am now working to update my Java Desktop application to also use PKCE with refresh tokens, and while looking at the examples I noticed a difference, in the way the DbxCredential is handled.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For android (&lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/DropboxClientFactory.java" target="_blank" rel="noopener"&gt;https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/android/src/main/java/com/dropbox/core/examples/android/DropboxClientFactory.java&lt;/A&gt;) it seem that a new DbxCredential object is created, using information from another DbxCredential object that was de-serialized (from stored preferences), which is then used to create the Client:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;public static void init(DbxCredential credential) {
        credential = new DbxCredential(credential.getAccessToken(), -1L, credential.getRefreshToken(), credential.getAppKey());
        if (sDbxClient == null) {
            sDbxClient = new DbxClientV2(DbxRequestConfigFactory.getRequestConfig(), credential);
        }
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;which is what I do in my Android App.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In the Java example (&lt;A href="https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/account-info/src/main/java/com/dropbox/core/examples/account_info/Main.java)" target="_blank" rel="noopener"&gt;https://github.com/dropbox/dropbox-sdk-java/blob/master/examples/account-info/src/main/java/com/dropbox/core/examples/account_info/Main.java)&lt;/A&gt; it seems like it just uses one DbxCredential object created by de-serializing, without using the info to create a new DbxCredential object:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="java"&gt;// Use DbxCredential instead of DbxAuthInfo.
        DbxCredential credential;
        try {
            credential = DbxCredential.Reader.readFromFile(argAuthFile);
        }
        catch (JsonReader.FileLoadException ex) {
            System.err.println("Error loading &amp;lt;auth-file&amp;gt;: " + ex.getMessage());
            System.exit(1); return;
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm just wondering why there is a difference? In the second example, is the Refresh token actually being refreshed?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your help.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 02:02:40 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526308#M25544</guid>
      <dc:creator>vewert</dc:creator>
      <dc:date>2021-06-11T02:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: DbxCredential Android vs Java</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526921#M25562</link>
      <description>&lt;P&gt;There isn't a big difference here. By setting the "-1L" expiration that makes the SDK immediately perform a refresh regardless of the actual expiration. The SDK will still handle the refresh process as/when needed though in either case, as long as the necessary pieces are given. (For PKCE, it only really needs the refresh token and app key.)&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 18:19:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526921#M25562</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-06-14T18:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: DbxCredential Android vs Java</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526924#M25564</link>
      <description>&lt;P&gt;Thanks Greg, that makes sense.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 18:22:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/DbxCredential-Android-vs-Java/m-p/526924#M25564</guid>
      <dc:creator>vewert</dc:creator>
      <dc:date>2021-06-14T18:22:49Z</dc:date>
    </item>
  </channel>
</rss>

