Forum Discussion

PBrackenSyn's avatar
PBrackenSyn
New member | Level 1
2 years ago
Solved

Are you able to login to the API through code only without a browser?

I am trying write a backup process that will run which obviously won't have any user interaction. It seems like the API only supports redirecting to a login page to authorize? Is this true or is there some other way to login?

  • That's correct, the user needs to authorize the app to access their account in their web browser. This only needs to be done once per account though. For long-term unattended access, the app should request "offline" access, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    That's correct, the user needs to authorize the app to access their account in their web browser. This only needs to be done once per account though. For long-term unattended access, the app should request "offline" access, in which case the app receives a "refresh token" that can be used to retrieve new short-lived access tokens as needed, without further manual user intervention. You can find more information in the OAuth Guide and authorization documentation. There's a basic outline of processing this flow in this blog post which may serve as a useful example.

  • PBrackenSyn's avatar
    PBrackenSyn
    New member | Level 1
    2 years ago

    So theoretically I could just login myself, capture the auth code, use postman or something to obtain the refresh token and then hard code that into my app and it should work?

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Yes, but note that that would only be for your own account. If this is only for your own use, that's fine, but you shouldn't distribute your refresh token to any other users.

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!