Start 2025 on time and up to date! Seamlessly integrate your calendars into Dropbox with these simple steps! 📆

Forum Discussion

blobwriter's avatar
blobwriter
Explorer | Level 4
4 years ago
Solved

OAuth2 w/ refresh tokens for hybrid apps

I have a little Cordova (I know react-native is cool now, but I strongly prefer Vue) app for Android+browser that uses Dropbox for sync, and for both platforms does auth by getting an OAuth2 bearer t...
  • Greg-DB's avatar
    4 years ago

    No, such apps are not forced to have the user re-authorize every four hours. Client-side apps like this can request "offline" access to get refresh tokens if needed. There's an example of requesting offline access from a client-side app (a front-end browser app, in this sample) using the official Dropbox API v2 JavaScript SDK here.

     

    The issue with the authorization URL you constructed is that the PKCE flow (which is how client-side apps can get offline access) is a form of the "response_type=code" flow, not "response_type=token".

     

    I recommend letting the SDK build that URL for you, like in the example here. If you do want to build that directly though, you can find the full authorization documentation here.