Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unattended DropBox .net back end access

I want my web server code (invoked from ASP.NET MVC3 site's controller) to be able to save files to Dropbox account.

I have examined two out of three .Net/Dropbox libraries and all of them require a user to "authenticate" via web-redirect to Dropbox to get a token.

Examined libs are Spring.Social.Dropbox and DropNet.

Can this authentication and upload be done via purely .net code without messing with the user's browser? Can the acquired token be saved for later use? This is theoretical question, not about particular implementation.

like image 590
Maxim V. Pavlov Avatar asked Mar 16 '12 13:03

Maxim V. Pavlov


1 Answers

This is a bit of a complicated subject. As far as I know Dropbox uses OAuth, which is an authentication and authorization protocol.

General process is this:

  1. You create authorization request token
  2. User gets redirected, authenticates and grants permissions to your app.
  3. You trade the request token for an access token
  4. You must save the access token because it is used to perform actions on the users behalf

Access tokens don't usually expire and only stop working if a user revokes your application permissions.

This means the user will have to authenticate and authorize your application at least once so you can get the access token and access token secret.

After that, you are pretty much free to perform actions on the users' behalf based on the permissions granted. You must specify the access token attained by the above-mentioned process in order to perform actions.

In short, get an access token, save it, use it for requests.

Does this clarify it a bit for you?

like image 169
Shelakel Avatar answered Oct 05 '22 22:10

Shelakel