We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

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,877 PostsLatest Activity: 12 months ago
326 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!