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: 

How to authenticate without browser/app in c# ?

How to authenticate without browser/app in c# ?

Dipak pote
New member | Level 1

How to authenticate without browser/app in c# ? 

I did all the operation on dropbox but at the start(only one time) it ask me for the username & password

But I don't want any popup for authentication.I need to do it through code.

Here is my sample code where popup out for username & password then I get the token:

private void GetAccessToken()
{
var login = new DropboxLogin(apiKey,appSecret);
login.Owner = this;
login.ShowDialog();

if (login.IsSuccessfully)
{
Properties.Settings.Default.AccessToken = login.AccessToken.Value;
Properties.Settings.Default.Save();
}
else
{
MessageBox.Show("Failed to get access token................");
}

}

Can you pleas help me?

Thanks in advance! 

 

4 Replies 4

Richard P.
Super User alumni

You cant do it through code, the entire point of it is so you do not handle user credentials in your code, you pass it off to the Dropbox OAuth system and get a token back in return.

Dipak pote
New member | Level 1

Can you please give me an idea to it. or any link which will help me to do it ?

Richard P.
Super User alumni

No, because you cannot do it - you must show the dialog as the SDK says - the code you have in your original post is the correct way to do it.

Greg-DB
Dropbox Staff

Richard's correct, Dropbox API apps should not handle the user's credentials, but should use the OAuth flow instead. Note that this only needs to be done once per user. Once your app has an access token for a user, it can store and re-use the access token for future API calls for that user without further manual user intervention. Access tokens don't expire by themselves (though they can be manually revoked).

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Richard P. Super User alumni
  • User avatar
    Dipak pote New member | Level 1
What do Dropbox user levels mean?