Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
In our Android app, I am having an issue where the dropbox.com authorize web page does not redirect back to our app when the user clicks the Allow button. I wrote a sample app and the OAuth2 flow works fine with that app on the same device\environment.
The first time you click the Allow button once the page displays, the page seems to refresh in Chrome. It seems like it's redirecting back to itself. The app does show up as connected to the account when I look in Settings for the user on dropbox.com. So that part of the auth flow is working - it's just not redirecting to the app.
I added the AuthActivity to the manifest...
<activity
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask">
<intent-filter>
<!-- Insert your app key after “db- ...” -->
<data android:scheme="db-xxxxxxx" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
And I am calling Auth.startOAuth2Authentication() here...
public void authenticateNewDropbox(Activity con) //++ Added con param
{
// Set bool so we know on Resume that we're logging into Dropbox
mIsDropboxLogin = true;
//Kick off auth2 flow: this launches the browser, and then back to us in OnResume() in the Activity
Auth.startOAuth2Authentication(con, con.getResources().getString(R.string.APP_KEY));
}
The app was previously doing OAuth2 with the v1 SDK and it worked fine. I've tried a new AppID as well. I don't see any relevant messages in the Android Monitor in Android Studio.
Been stuck on this for a couple days and I can't understand what I'm doing wrong. Thanks for any help.
Just to follow up... Setting the taskAffinity property in the manifest for the dropbox AuthActivity seemed to fix the problem. The oauth flow is now able to relaunch our app. I also set excludeFromRecents to true which cleared up another issue but could be involved here as well.
Thanks! I'm glad to hear you were able to track that down.
@Drageniix If you're still seeing this, can you try that as well?
Can you please elabourate. How to set this attribute and exactly where.
@Rishi I believe they were referring to setting 'taskAffinity' and/or 'excludeFromRecents' for the 'com.dropbox.core.android.AuthActivity' in the app's AndroidManifest.xml, e.g., here in the sample:
The Android documentation for these can be found here:
https://developer.android.com/guide/topics/manifest/activity-element
@Greg-DB
@Greg K. I am glad that you responded. I tried both attributes but it did not helped me. I copied everything from example to my application. And problem is still not resolved.
When I am clicking on manual back after clicking on allow, app does have a token and it is fetching all the files. But I want browser to redirect to my application automatically after clicking allow button.
Please help me. I am stucked on this since 2 days.
@Rishi First, for reference, does the redirect work in the Android sample app itself for you?
If so, can you provide your own test project that reproduces this issue so we can reproduce it here and investigate? Thanks in advance!
@Greg-DB yes, Sample android application is working fine and getting redirected to original app. but I have copied each file in my application, It is not happening. allow is not redirecting from my chrome browser to my application.
@Rishi Since the sample application works, it sounds like there's something about how your app is set up that is causing this.
So that we can reproduce it and look into it, can you make and share a test project that shows this issue? Thanks in advance!
Hi there!
If you need more help you can view your support options (expected response time for a 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!