You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Ernie T.1's avatar
Ernie T.1
Explorer | Level 4
3 years ago

Java SDK - Android - Log in error: "Couldn't connect to Dropbox"

My old code uses tokens that now expire after 4 hours.  I'm trying to update my Android/Java code to fix this, but I'm having trouble getting past the login ("Allow") screen.

 

My OLD auth code is below, and works, but expires after 4 hours:

Auth.startOAuth2Authentication(activity, appKey);

My NEW code looks like below.  I get a login screen that says, "(app) would like access to...."  But when I tap "Allow" in this final Dropbox login screen , I get an error which I think it coming from Dropbox (before control is returned to my Activity): "Couldn't connect to Dropbox. Please make sure you have an internet connection and try again."  I'm running on actual device.

List<String> scopes = Arrays.asList("account_info.read", "files.content.write");
Auth.startOAuth2PKCE(activity, appKey, getConfig(), scopes);

 

 My Dropbox "apps" are many years old, so not sure if this has something to do with the error. 

I'm not sure how to continue.  Any help would be appreciated.

 

I created a new Dropbox App with Permission Type: "Scoped App", and it works.  So it seems Auth.startOAuth2PKCE is not working with my older pre-"scoped" apps.

 

Ernie

  • Are you using an app key for an app that hasn't been migrated to scopes yet? This can occur if so. (Apologies for the unhelpful error message!) In order to use the updated app authorization flow, you'll need to use an app key for an app that is set to use scopes.

     

    You can migrate an existing app to scopes via the app's page on the App Console.

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

    Are you using an app key for an app that hasn't been migrated to scopes yet? This can occur if so. (Apologies for the unhelpful error message!) In order to use the updated app authorization flow, you'll need to use an app key for an app that is set to use scopes.

     

    You can migrate an existing app to scopes via the app's page on the App Console.

    • Ernie T.1's avatar
      Ernie T.1
      Explorer | Level 4

      Thanks!

       

      (I edited post to remove a question.  All sorted.  I'll see if my tokens continue to work after 4 hours....)

       

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

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 or Facebook.

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!