cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Get summer ready with Dropbox basic - travel documents, plans, progress reminders and more, right over here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

Ernie T.1
Explorer | Level 4

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

1 Accepted Solution

Accepted Solutions

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

Greg-DB
Dropboxer

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.

View solution in original post

2 Replies 2

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

Greg-DB
Dropboxer

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.

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

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....)

 

Poll
Which Dropbox Plan do you have?
Who's talking

Top contributors to this post

  • User avatar
    Ernie T.1 Explorer | Level 4
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?