cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.NET SDK System.AggregateException OAuth 2 access token is malformed ?

.NET SDK System.AggregateException OAuth 2 access token is malformed ?

LOWRY G.
New member | Level 1

Message=Error in call to API function "users/get_current_account":
    The given OAuth 2 access token is malformed.

https://www.dropbox.com/developers/documentation/dotnet#tutorial

(a) installed Dropbox .NET SDK via NuGet

(b) registered Dropbox API app using the "App Console"

(c) copied this text from the .NET tutorial page mention above.

(d) replaced "YOUR ACCESS TOKEN" in the line below with the App key from step (b) above:

using (var dbx = new DropboxClient("YOUR ACCESS TOKEN"))

(e) the code compiles BUT crashes on the line after the using:

var full = await dbx.Users.GetCurrentAccountAsync();
The ERROR is:

Message=Error in call to API function
"users/get_current_account":
The given OAuth 2 access token is malformed."

The app key provided by the Dropbox App Console
is 15 alphanumeric characters with this form:

aannnaaaaaaaana

How can it be malformed when it was copied and pasted
from the middle of a page with an URL that even contained
the App key as part of the URL:

https://www.dropbox.com/developers/apps/info/aannnaaaaaaaana

The outer exception is:

System.AggregateException was unhandled
HResult=-2146233088

2 Replies 2

Greg-DB
Dropbox Staff

[Cross-linking for reference: https://stackoverflow.com/questions/38462091/net-sdk-system-aggregateexception-oauth-2-access-token-... ]

It looks like you're using your app's "app key", instead of an "access token". These are different from each other. The app key identifies your app, whereas an access token identifies an app-user pair, and allows access to that user's account. 

You can generate an access token for your app on your account on the app's page on the App Console, using the "Generate" button.

LOWRY G.
New member | Level 1

Gregory, thank you.   much appreciated.  issue is resolved.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    LOWRY G. New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?