cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close
cancel
Showing results for 
Search instead for 
Did you mean: 

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

LOWRY G. New member | Level 1
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

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

Dropboxer
Dropboxer

[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.

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

LOWRY G. New member | Level 1
New member | Level 1

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

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?