We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Dipak pote
11 years agoNew member | Level 1
How to authenticate without browser/app in c# ?
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
Replies have been turned off for this discussion
- Richard P.11 years ago
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 pote11 years agoNew member | Level 1
Can you please give me an idea to it. or any link which will help me to do it ?
- Richard P.11 years ago
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-DB11 years ago
Dropbox Community Moderator
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).
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!