<?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 API v2 get_current_user error in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185483#M7824</link>
    <description>&lt;DIV class="comment-body markdown"&gt;
&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;i've bumped into this issue migrating from v1 to v2:&lt;/P&gt;
&lt;P&gt;after getting the auth code from this endpoint:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/oauth2/authorize" rel="nofollow noreferrer" target="_blank"&gt;https://www.dropbox.com/oauth2/authorize&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;and getting the token from this endpoint:&lt;BR /&gt;https://api.dropbox.com/oauth2/token&lt;/PRE&gt;
&lt;P&gt;i am trying to get user's display name. as far as i understand you've changed user endpoint to this one:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer" target="_blank"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but all i get from api is this:&lt;/P&gt;
&lt;P&gt;{protocol=http/1.1, code=400, message=Bad Request, url=&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer" target="_blank"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;}&lt;/P&gt;
&lt;P&gt;The same code works fine with api v1. Please give me hints if you have any.&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Wed, 29 May 2019 09:30:34 GMT</pubDate>
    <dc:creator>Eugene G.4</dc:creator>
    <dc:date>2019-05-29T09:30:34Z</dc:date>
    <item>
      <title>API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185483#M7824</link>
      <description>&lt;DIV class="comment-body markdown"&gt;
&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;i've bumped into this issue migrating from v1 to v2:&lt;/P&gt;
&lt;P&gt;after getting the auth code from this endpoint:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.dropbox.com/oauth2/authorize" rel="nofollow noreferrer" target="_blank"&gt;https://www.dropbox.com/oauth2/authorize&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;and getting the token from this endpoint:&lt;BR /&gt;https://api.dropbox.com/oauth2/token&lt;/PRE&gt;
&lt;P&gt;i am trying to get user's display name. as far as i understand you've changed user endpoint to this one:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer" target="_blank"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;but all i get from api is this:&lt;/P&gt;
&lt;P&gt;{protocol=http/1.1, code=400, message=Bad Request, url=&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer" target="_blank"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;}&lt;/P&gt;
&lt;P&gt;The same code works fine with api v1. Please give me hints if you have any.&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 29 May 2019 09:30:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185483#M7824</guid>
      <dc:creator>Eugene G.4</dc:creator>
      <dc:date>2019-05-29T09:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185484#M7825</link>
      <description>&lt;P&gt;[Cross-linking for reference:&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/39074097/dropbox-api-v2-get-current-user" rel="nofollow noreferrer"&gt;https://stackoverflow.com/questions/39074097/dropbox-api-v2-get-current-user&lt;/A&gt; ]&lt;/P&gt;
&lt;P&gt;Can you post the full response body? It should have a more useful error message.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 00:29:57 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185484#M7825</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-08-26T00:29:57Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185485#M7826</link>
      <description>&lt;P&gt;there's nothing in response body, only this message:&lt;/P&gt;
&lt;P&gt;Response{protocol=http/1.1, code=400, message=Bad Request, url=&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;}&lt;/P&gt;
&lt;P&gt;response headers:&lt;/P&gt;
&lt;P&gt;0 = "Server"&lt;BR /&gt;1 = "nginx"&lt;BR /&gt;2 = "Date"&lt;BR /&gt;3 = "Fri, 26 Aug 2016 10:10:19 GMT"&lt;BR /&gt;4 = "Content-Type"&lt;BR /&gt;5 = "text/plain; charset=utf-8"&lt;BR /&gt;6 = "Content-Length"&lt;BR /&gt;7 = "163"&lt;BR /&gt;8 = "Connection"&lt;BR /&gt;9 = "keep-alive"&lt;BR /&gt;10 = "Content-Disposition"&lt;BR /&gt;11 = "attachment; filename=unspecified"&lt;BR /&gt;12 = "Content-Security-Policy"&lt;BR /&gt;13 = "sandbox"&lt;BR /&gt;14 = "Vary"&lt;BR /&gt;15 = "Dropbox-API-Arg, Authorization"&lt;BR /&gt;16 = "X-Content-Security-Policy"&lt;BR /&gt;17 = "sandbox"&lt;BR /&gt;18 = "X-Dropbox-Request-Id"&lt;BR /&gt;19 = "fabc4a62296d3264878e3fb2af1224eb"&lt;BR /&gt;20 = "X-Webkit-Csp"&lt;BR /&gt;21 = "sandbox"&lt;BR /&gt;22 = "OkHttp-Sent-Millis"&lt;BR /&gt;23 = "1472206218027"&lt;BR /&gt;24 = "OkHttp-Received-Millis"&lt;BR /&gt;25 = "1472206218482"&lt;/P&gt;
&lt;P&gt;i hope it helps&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 17:15:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185485#M7826</guid>
      <dc:creator>Eugene G.4</dc:creator>
      <dc:date>2016-08-26T17:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185486#M7827</link>
      <description>&lt;P&gt;"there's nothing in response body"&lt;/P&gt;
&lt;P&gt;This is very unlikely to be true. I don't think the Dropbox API&amp;nbsp;&lt;EM&gt;ever&lt;/EM&gt; returns a 400 response without a&amp;nbsp;response body explaining the issue.&lt;/P&gt;
&lt;P&gt;Can you share the&amp;nbsp;code&amp;nbsp;you're using to&amp;nbsp;read&amp;nbsp;the response body?&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2016 22:57:37 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185486#M7827</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-08-26T22:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185487#M7828</link>
      <description>&lt;P&gt;In fact, this header indicates there's a 163-byte response. You'll need to read that response to see what the error is.&lt;/P&gt;
&lt;PRE&gt;6 = "Content-Length"&lt;BR /&gt;7 = "163"&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Aug 2016 22:58:19 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185487#M7828</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-08-26T22:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185488#M7829</link>
      <description>&lt;P&gt;Here's my code:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;private static final &lt;/SPAN&gt;String &lt;SPAN&gt;DROPBOX_TOKEN_ENDPOINT &lt;/SPAN&gt;= &lt;SPAN&gt;"https://api.dropbox.com/oauth2/token"&lt;/SPAN&gt;;&lt;BR /&gt;&lt;SPAN&gt;private static final &lt;/SPAN&gt;String &lt;SPAN&gt;DROPBOX_ACCOUNT_INFO_ENDPOINT &lt;/SPAN&gt;= &lt;SPAN&gt;"https://api.dropboxapi.com/2/users/get_current_account"&lt;/SPAN&gt;;&lt;/PRE&gt;
&lt;PRE&gt; OkHttpClient client = &lt;SPAN&gt;new &lt;/SPAN&gt;OkHttpClient();&lt;BR /&gt;&lt;BR /&gt; RequestBody body = &lt;SPAN&gt;new &lt;/SPAN&gt;MultipartBuilder().type(MultipartBuilder.&lt;SPAN&gt;FORM&lt;/SPAN&gt;)&lt;BR /&gt; .addFormDataPart(&lt;SPAN&gt;"code"&lt;/SPAN&gt;, &lt;SPAN&gt;code&lt;/SPAN&gt;)&lt;BR /&gt; .addFormDataPart(&lt;SPAN&gt;"grant_type"&lt;/SPAN&gt;, &lt;SPAN&gt;"authorization_code"&lt;/SPAN&gt;)&lt;BR /&gt; .addFormDataPart(&lt;SPAN&gt;"client_id"&lt;/SPAN&gt;, AuthKeyConstants.&lt;SPAN&gt;DROPBOX_APP_KEY&lt;/SPAN&gt;)&lt;BR /&gt; .addFormDataPart(&lt;SPAN&gt;"client_secret"&lt;/SPAN&gt;, AuthKeyConstants.&lt;SPAN&gt;DROPBOX_APP_SECRET&lt;/SPAN&gt;)&lt;BR /&gt; .addFormDataPart(&lt;SPAN&gt;"redirect_uri"&lt;/SPAN&gt;, AuthKeyConstants.&lt;SPAN&gt;DROPBOX_REDIRECT_URL&lt;/SPAN&gt;)&lt;BR /&gt; .build();&lt;BR /&gt; Request request = &lt;SPAN&gt;new &lt;/SPAN&gt;Request.Builder()&lt;BR /&gt; .url(&lt;SPAN&gt;DROPBOX_TOKEN_ENDPOINT&lt;/SPAN&gt;)&lt;BR /&gt; .post(body)&lt;BR /&gt; .build();&lt;BR /&gt; &lt;SPAN&gt;try &lt;/SPAN&gt;{&lt;BR /&gt; Response response = client.newCall(request).execute();&lt;BR /&gt; &lt;SPAN&gt;if &lt;/SPAN&gt;(response.isSuccessful()) {&lt;BR /&gt; String responseBody = response.body().string();&lt;BR /&gt; JsonObject json = (JsonObject) &lt;SPAN&gt;new &lt;/SPAN&gt;JsonParser().parse(responseBody);&lt;BR /&gt; String accessToken = json.get(&lt;SPAN&gt;"access_token"&lt;/SPAN&gt;).getAsString();&lt;BR /&gt; String accountId = json.get(&lt;SPAN&gt;"uid"&lt;/SPAN&gt;).getAsString();&lt;BR /&gt; response.body().close();&lt;BR /&gt; Request userRequest = &lt;SPAN&gt;new &lt;/SPAN&gt;Request.Builder()&lt;BR /&gt; .url(&lt;SPAN&gt;DROPBOX_ACCOUNT_INFO_ENDPOINT&lt;/SPAN&gt;)&lt;BR /&gt; .addHeader(&lt;SPAN&gt;"Authorization"&lt;/SPAN&gt;, &lt;SPAN&gt;"Bearer " &lt;/SPAN&gt;+ accessToken)&lt;BR /&gt; .build();&lt;BR /&gt; Response accountResponse = client.newCall(userRequest).execute();&lt;BR /&gt; &lt;SPAN&gt;if &lt;/SPAN&gt;(accountResponse.isSuccessful()) {&lt;BR /&gt; responseBody = accountResponse.body().string();&lt;BR /&gt; accountResponse.body().close();&lt;BR /&gt; json = (JsonObject) &lt;SPAN&gt;new &lt;/SPAN&gt;JsonParser().parse(responseBody);&lt;BR /&gt; String userName = json.get(&lt;SPAN&gt;"name"&lt;/SPAN&gt;).getAsJsonObject().get(&lt;SPAN&gt;"display_name"&lt;/SPAN&gt;).getAsString();&lt;BR /&gt; &lt;SPAN&gt;// save new Dropbox account here&lt;BR /&gt;&lt;/SPAN&gt; } &lt;SPAN&gt;else &lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;ERROR_RESPONSE_UNSUCCESSFUL&lt;/SPAN&gt;;&lt;BR /&gt; }&lt;BR /&gt; } &lt;SPAN&gt;else &lt;/SPAN&gt;{&lt;BR /&gt; &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;ERROR_RESPONSE_UNSUCCESSFUL&lt;/SPAN&gt;;&lt;BR /&gt; }&lt;BR /&gt; } &lt;SPAN&gt;catch &lt;/SPAN&gt;(IOException e) {&lt;BR /&gt; e.printStackTrace();&lt;BR /&gt; &lt;SPAN&gt;return &lt;/SPAN&gt;&lt;SPAN&gt;ERROR_EXCEPTION&lt;/SPAN&gt;;&lt;BR /&gt; }&lt;/PRE&gt;
&lt;P&gt;The first call is a success, i get access_token no problem from there. I used debugging to see everything in accountResponse and this is what i got: success = false, body = null, code=400, message=Bad Request, url=&lt;A href="https://api.dropboxapi.com/2/users/get_current_account" rel="nofollow noreferrer"&gt;https://api.dropboxapi.com/2/users/get_current_account&lt;/A&gt;}&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:17:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185488#M7829</guid>
      <dc:creator>Eugene G.4</dc:creator>
      <dc:date>2016-08-29T13:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185489#M7830</link>
      <description>&lt;P&gt;How about this so you can see the actual response body?&lt;/P&gt;
&lt;PRE&gt;} else {&lt;BR /&gt;    String responseBody = accountResponse.body().string();&lt;BR /&gt;    // log or just inspect responseBody&lt;BR /&gt;&lt;BR /&gt;    accountResponse.body().close();&lt;BR /&gt;&lt;BR /&gt;    return ERROR_RESPONSE_UNSUCCESSFUL;&lt;BR /&gt;}&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Aug 2016 13:26:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185489#M7830</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-08-29T13:26:47Z</dc:date>
    </item>
    <item>
      <title>Re: API v2 get_current_user error</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185490#M7831</link>
      <description>&lt;P&gt;ok. now i get it. thank you.&lt;/P&gt;
&lt;P&gt;Error in call to API function "users/get_current_account": Your request's HTTP request method is "GET".&amp;nbsp; This function only accepts the HTTP request method "POST".&lt;/P&gt;
&lt;P&gt;changing to post&lt;/P&gt;</description>
      <pubDate>Mon, 29 Aug 2016 15:16:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/API-v2-get-current-user-error/m-p/185490#M7831</guid>
      <dc:creator>Eugene G.4</dc:creator>
      <dc:date>2016-08-29T15:16:49Z</dc:date>
    </item>
  </channel>
</rss>

