<?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: Catching invalid access token exceptions in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179851#M7347</link>
    <description>&lt;P&gt;Maybe it is the way I faked the invalid token.&amp;nbsp; Instead of passing a real, but invalidated token, I passed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; "Z" + validToken&lt;/P&gt;
&lt;P&gt;to the "new DbxClientV2(requestConfig, DBaccessToken);" API call.&amp;nbsp; So it has one more letter than the real token.&amp;nbsp; And the message with that exception is "OAuth2 token is mal-formed".&amp;nbsp; I'll bet that's it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2016 05:41:48 GMT</pubDate>
    <dc:creator>Robert S.138</dc:creator>
    <dc:date>2016-07-29T05:41:48Z</dc:date>
    <item>
      <title>Catching invalid access token exceptions</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179849#M7345</link>
      <description>&lt;P&gt;In the Android Core API v2 SDK, when a Dropbox access token becomes invalid, I want to catch that exception and null out my copy of the access token so the linking authorization will be done again.&amp;nbsp; The trouble is, I don't know how to exactly qualify that particular exception.&amp;nbsp; For testing purposes I have deliberately fed the wrong access token to the API (rather than invalidate the actual token with Dropbox).&amp;nbsp; For me, the exception happens on listFolder().&amp;nbsp; And the exception thrown is the DbxException.&amp;nbsp; Buy why isn't it the InvalidAccessTokenException?&amp;nbsp; Apparently that is a real thing, a subclass of DbxException.&amp;nbsp; But it does not check with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(e instanceof InvalidAccessTokenException)&lt;/P&gt;
&lt;P&gt;but only with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; if(e instanceof DbxException)&lt;/P&gt;
&lt;P&gt;If there are any other reasons for any of these API functions to throw a DbxException besides an invalid access token, it would be wrong for me to pretend that the access token is the only problem.&amp;nbsp; So I would like to detect when this specific exception is thrown, as distinct from all others.&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:31:15 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179849#M7345</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2019-05-29T09:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Catching invalid access token exceptions</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179850#M7346</link>
      <description>&lt;P&gt;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/InvalidAccessTokenException.html" target="_blank" rel="nofollow noreferrer"&gt;InvalidAccessTokenException&lt;/A&gt; does get thrown for me when calling listFolder with an invalid access token. (Both&amp;nbsp;catching InvalidAccessTokenException and using&amp;nbsp;instanceof work as expected in my test.)&lt;/P&gt;
&lt;P&gt;Can you share your code that reproduces this? What version of the SDK do you have installed?&lt;/P&gt;
&lt;P&gt;Also, please print and share the stack trace for the exception you do get.&amp;nbsp;Thanks in advance!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 05:13:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179850#M7346</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-29T05:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Catching invalid access token exceptions</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179851#M7347</link>
      <description>&lt;P&gt;Maybe it is the way I faked the invalid token.&amp;nbsp; Instead of passing a real, but invalidated token, I passed&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; "Z" + validToken&lt;/P&gt;
&lt;P&gt;to the "new DbxClientV2(requestConfig, DBaccessToken);" API call.&amp;nbsp; So it has one more letter than the real token.&amp;nbsp; And the message with that exception is "OAuth2 token is mal-formed".&amp;nbsp; I'll bet that's it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 05:41:48 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179851#M7347</guid>
      <dc:creator>Robert S.138</dc:creator>
      <dc:date>2016-07-29T05:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Catching invalid access token exceptions</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179852#M7348</link>
      <description>&lt;P&gt;Yes, that would do it. That gives you that&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/BadRequestException.html" target="_blank" rel="nofollow noreferrer"&gt;BadRequestException&lt;/A&gt;&amp;nbsp;instead, since the token is recognizably not the right format. If instead you just modify an existing character in the access token in place you can force the&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/InvalidAccessTokenException.html" target="_blank" rel="nofollow noreferrer"&gt;InvalidAccessTokenException&lt;/A&gt; instead.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 08:00:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Catching-invalid-access-token-exceptions/m-p/179852#M7348</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-07-29T08:00:36Z</dc:date>
    </item>
  </channel>
</rss>

