cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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

Re: How to authenticate without browser/app in c# ?

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.

Re: How to authenticate without browser/app in c# ?

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 ?

Re: How to authenticate without browser/app in c# ?

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.

Re: How to authenticate without browser/app in c# ?

Greg-DB
Dropboxer

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

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

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