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: 

Dropbox requests via a server

Dropbox requests via a server

Coder
Explorer | Level 4

We need users to login to our system only and access one dropbox account only. In other words many users access the same dropbox account. That account is a company account with shared readonly documents. We don't want the users access the dropbox account, so the server only has the credentials to access that only dropbox account.

5 Replies 5

axew3
Collaborator | Level 8
what system? it is a web site or desktop app?
... the question isn't very clear to me ...

Greg-DB
Dropbox Staff
The API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. However, it is technically possible to connect to just one account. The SDKs don't offer explicit support for it and we don't recommend doing so, for various technical and security reasons.

However if you did want to go this route, instead of kicking off the authorization flow, you would manually use an existing access token for your account and app. (Just be careful not to revoke it, e.g. via https://www.dropbox.com/account/security .)

Coder
Explorer | Level 4

Hello,

 

But it's not possible to call in the .NET code a think like:

 

var _auth = getAuth("dropBoxUser","UserPassword")

 

without having a popup asking for credentials?

 

Thanks.

Coder
Explorer | Level 4

I'm trying to do this:

 

curl -X POST https://content.dropboxapi.com/2/sharing/get_shared_link_file --header "Authorization: Bearer i8QD8..." --header "Dropbox-API-Arg: {\"url\": \"https://www.dropbox.com/s/g1mijjb5deejf6h/Test.txt?dl=0\"}"

 

that works. Doing it In .NET:

 

string _url = "https://content.dropboxapi.com/2/sharing/get_shared_link_file"; 
client.Headers.Add("Authorization", "Bearer i8Q......");
string _dropBoxParams = "{\"url\": \"https://www.dropbox.com/s/g1mijjb5deejf6h/Test.txt?dl=0\"}";
client.Headers.Add("Dropbox-API-Arg", _dropBoxParams); 
byte[] _responsebytes = client.UploadValues(_url, "POST", _postParameter);

 

but it gives:  The remote server returned an error: (400) Bad Request. 

What is the problem?

 

 

Greg-DB
Dropbox Staff

If you're going to use a single account like this, you should embed the access token like you do in your most recent post, not via username/password.

 

If you're doing this in .NET, we highly recommend using the official API v2 .NET SDK. That would do much of the work for you. If you use that, to make this call you would use the GetSharedLinkFileAsync method.

 

Otherwise, if you do want to make the call directly, without using the SDK, print the body of the response. That will contain more error information indicating what the issue is.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Coder Explorer | Level 4
  • User avatar
    axew3 Collaborator | Level 8
What do Dropbox user levels mean?