<?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: How to check validity of access token in java code in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86232#M2637</link>
    <description>&lt;P&gt;Just try it and look for a 401 response to indicate an auth problem.&lt;/P&gt;

&lt;P&gt;I might use the &lt;CODE&gt;/account/info&lt;/CODE&gt; endpoint for this (since it pretty much can't fail for any other reason).&lt;/P&gt;

&lt;P&gt;But note that the access token could be revoked at any time, so you'll still need to handle the case where the call you're actually making fails. E.g., this is an anti-pattern.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (isValid(token)) {
    // What if the token gets revoked right here? After you checked but before you upload the file?
    uploadFile(..., token);
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since the check doesn't really save you having to do the error handling, you may as well just try to upload the file and handle the 401 error if it occurs.&lt;/P&gt;</description>
    <pubDate>Fri, 10 Apr 2015 23:19:13 GMT</pubDate>
    <dc:creator>Steve M.</dc:creator>
    <dc:date>2015-04-10T23:19:13Z</dc:date>
    <item>
      <title>How to check validity of access token in java code</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86231#M2636</link>
      <description>&lt;P&gt;How to check validity of access token in java code before using it?&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:43:45 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86231#M2636</guid>
      <dc:creator>Abdullah S.1</dc:creator>
      <dc:date>2019-05-29T09:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to check validity of access token in java code</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86232#M2637</link>
      <description>&lt;P&gt;Just try it and look for a 401 response to indicate an auth problem.&lt;/P&gt;

&lt;P&gt;I might use the &lt;CODE&gt;/account/info&lt;/CODE&gt; endpoint for this (since it pretty much can't fail for any other reason).&lt;/P&gt;

&lt;P&gt;But note that the access token could be revoked at any time, so you'll still need to handle the case where the call you're actually making fails. E.g., this is an anti-pattern.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (isValid(token)) {
    // What if the token gets revoked right here? After you checked but before you upload the file?
    uploadFile(..., token);
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Since the check doesn't really save you having to do the error handling, you may as well just try to upload the file and handle the 401 error if it occurs.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Apr 2015 23:19:13 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86232#M2637</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2015-04-10T23:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to check validity of access token in java code</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86233#M2638</link>
      <description>&lt;P&gt;I've 2 programs one to get the token and serialize it and the other is to deserialize it and use it maybe on another pc&lt;BR /&gt;
i want the first one to read the .ser file that generated from the last use and check if it is valid or not&lt;BR /&gt;
so i have two solutions now&lt;BR /&gt;
1- make the first program create small file and test the access token to upload it and then delete it if it is uploaded.&lt;BR /&gt;
2- make the first program get new access token every time and serialize it.&lt;BR /&gt;
thanks for your reply &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;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Apr 2015 00:15:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-check-validity-of-access-token-in-java-code/m-p/86233#M2638</guid>
      <dc:creator>Abdullah S.1</dc:creator>
      <dc:date>2015-04-11T00:15:59Z</dc:date>
    </item>
  </channel>
</rss>

