Forum Discussion

aalok's avatar
aalok
Explorer | Level 4
3 years ago

generate code by using curl dropbox api

I don't want user interaction to click and allow a button to get code. I want to get it through curl or api.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    It is not possible to fully automate the OAuth process where the user chooses to authorize the app and the app then receives the resulting access token and optional refresh token. This needs to be done manually by the user at least once. If your app needs to maintain long-term access without the user manually re-authorizing it repeatedly, the app should request "offline" access so that it gets a refresh token. The refresh token doesn't expire and can be stored and used repeatedly to get new short-lived access tokens whenever needed, without the user manually reauthorizing the app.

     

    You can find more information on this in the OAuth Guide and authorization documentation.

    • aalok's avatar
      aalok
      Explorer | Level 4

      Any curl API to get refresh token and how to check whether access token expired or not.plz, send me an updated API document link.

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        Hi aalok,

        A minimalistic example of what you're asking for can be seen here. The example shows API access using CURL, but it's the same while using any other way/HTTP access method (HTTP client). Of course, once get familiar with the OAuth' idea, you can extend the example to use different authentication methods (PKCE, for instance) and improve automation (with a loopback port to get the code without copy/paste, using 'netcat' for example or similar). 😉

        Hope this helps.