Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
NachoMurphy
9 years agoExplorer | Level 3
Dropbox Xamarin OAuth Flow Question - Retrieving the Access Token
Hi there, I have a mobile app on Android that uses Xamarin's tools to do some basic dropbox operations. In the past we used the Sync SDK to use dropbox quite easily. With the June v1 shut off comin...
NachoMurphy
9 years agoExplorer | Level 3
Thanks - yes, I was able to resolve the ClassNotFound issue. As it happens, I'm pursuing the Java SDK approach after all; it makes more sense and is easier to use for Android than the .NET SDK. I'm still determined to solve this!
I'm still stuck at the redirect point in the auth flow, however. It just tries to redirect in the browser - I can even see the parameters in the address field.
When I reach the redirect point, I'm still not getting back to my app. The redirect URL parameter remains as https://localhost/
I've still got it set in the developer app settings page as well:
My manifest is much the same still:
<activity android:name=".ImageGallery" >
<intent-filter>
<data android:scheme="db-<appkeygoeshere>" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data android:scheme="https" android:host="localhost"></data>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
</intent-filter>
</activity>
It's got to be something trivial I think, like a typo in my actual auth address or manifest. Right now the auth address looks like this(sensitive values removed):
"https://www.dropbox.com/1/oauth2/authorize?client_id=db-mydropboxappkey& response_type=token&redirect_uri=https://localhost/& state=mygeneratedstateid"
A couple more questions that might help:
In my dropbox developer apps page, this app still has the development status - I don't have to be in production status for this to work right?
Also, I've implemented parts of the Auth and AuthActivity classes from the Java SDK to help me sort this out. One thing I've noticed is when I run AuthActivity.checkAppBeforeAuth, I never get any Activity results when it calls packageManager.QueryIntentActivities. Would that indicate I still don't have the manifest set correctly?
Edit: I'm still getting the class not found error after all.
It shows up after I exit debug mode, so without being patient I had thought it was gone.
One thing I noticed: If I generate an Intent address for ImageGallery, the expanded path to the activity is MyApp.App/md5fac3f4919a5b0b9804623e8f923fe925.ImageGallery. If I use that instead of just .ImageGallery in the <activity> element of my manifest, there's a compilation error. Perhaps that's my issue? I can buid when I append that to my <manifest> element however, so I'll try that next.
Greg-DB
Dropbox Community Moderator
9 years agoAs long as you're able to use it in Xamarin, using the Dropbox Java SDK is probably a better route. In that case, I highly recommend just using the pre-built Android app authorization flow.
In that case, there should just be a few things you need to do:
1) Set up your manigest as shown here:
2) Start the authorization flow using startOAuth2Authentication as shown here:
3) Receive the result using getOAuth2Token as shown here:
Using that, you don't need to configure the redirect URI, etc. yourself. I'm not sure I follow your question about implementing Auth/AuthActivity though. Those are part of the SDK, so you shouldn't need to implement them yourself. If you're not getting anything back from QueryIntentActivities though, that should indicate that you don't have your URL scheme registered correctly. Double check your manifest against the link in #1 above.
And that's correct, development status is fine for now. Production status would just enable more users to connect to your app, but it's not necessary while you're developing and using your own account.
I'm afraid I cant offer help setting up the ImageGallery activity itself.
- NachoMurphy9 years agoExplorer | Level 3
Thanks for all your help Greg. I'll be sure to post if I need any help in the future. At this point, I'm going to try a different approach given the circumstances.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!