Forum Discussion

lovin a.'s avatar
lovin a.
New member | Level 1
11 years ago

Authenticate using username/password in java

can anybody tell me how to authenticate via dropbox username password in my desktop application.

7 Replies

Replies have been turned off for this discussion
  • Richard P.'s avatar
    Richard P.
    Icon for Super User alumni rankSuper User alumni
    11 years ago

    You can't - you have to use the OAuth authentication flow, you cannot authenticate using a username and password.

  • lovin a.'s avatar
    lovin a.
    New member | Level 1
    11 years ago

    Does this mean, every user who want to access dropbox files, need to create an dropbox app and generate consumer key and secret?

  • Richard P.'s avatar
    Richard P.
    Icon for Super User alumni rankSuper User alumni
    11 years ago

    No, users just have to authenticate using the OAuth process flow - the application will have your keys and secrets embedded in it, they don't have to generate their own.

  • lovin a.'s avatar
    lovin a.
    New member | Level 1
    11 years ago

    thanks for prompt response...
    yes we can keep key. secret inside application. so which OAUTH flow we can use so that for new user we can get access token...i cant find grantType password working in dropbox which is way to pass username/password

  • Richard P.'s avatar
    Richard P.
    Icon for Super User alumni rankSuper User alumni
    11 years ago

    As I said before, you can't have your users present their Dropbox username and password to your application - that is not allowed.

    You have to use the authentication flow detailed here:

    https://www.dropbox.com/developers/core/start/java

    This flow connects to the Dropbox servers using a browser instance, allows the user to authenticate directly with the Dropbox servers, and gives you an authentication token at the end of it. It is that authentication token that you then use to access Dropbox on behalf of that user.

  • lovin a.'s avatar
    lovin a.
    New member | Level 1
    11 years ago

    ohh this is 3legged flow...
    Dropbox dnt support "4.3 Resource Owner Password Credentials Grant" ??
    Oauth2 specs: https://tools.ietf.org/html/rfc6749#section-1.3.3
    POST /token HTTP/1.1
    Host: server.example.com
    Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW
    Content-Type: application/x-www-form-urlencoded

     grant_type=password&username=johndoe&password=A3ddj3w
    

About Dropbox API Support & Feedback

Node avatar for 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!