Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
harunctgbd
7 years agoExplorer | Level 3
Android SDK auth access token malformed when Access Token use in Dropbox JS SDK
Recently I have included Dropbox in my ionic 1 android application through Dropbox JavaScript SDK for user data backup. I have used inAppBrowser for the authentication process. Everything is working ...
Greg-DB
Dropbox Community Moderator
7 years agoYou mentioned you checked in LogCat on the Android side, but did you also add some logging to check on the JavaScript side? I recommend doing so if you haven't.
And then when you do inspect it in JavaScript, does it have the same format as the sample I shared in my previous post?
harunctgbd
7 years agoExplorer | Level 3
Yes, I have checked both side and both side token received same. Here is one token which I retrieved and revoked it. There is no extra whitespace before or after the token string.
XMtgp6WiHTAAAAAAAAAC4XhwiE-frZfooOu0Hxu5EmTfGUU38c6KakU0uqQDM77t
I can not figure out what's the problem :(
- Greg-DB7 years ago
Dropbox Community Moderator
Thanks. That does look valid. I also just tried it in the JavaScript SDK using your code and it worked as expected for me. (It failed with a 401 Unauthorized; the malformed check occurs first, so it would fail with the malformed error even if the token is revoked.)
Just to check, can you make sure you're not actually saving the token with that "Token:" prefix? I imagine that's just how you're printing it, but it would be good to make sure.
Otherwise, please share the rest of the relevant code to reproduce this so we can reproduce it here to investigate it.
- harunctgbd7 years agoExplorer | Level 3
Thanks for your quick response. I used only token string. The leading 'Token:' that I used in my console log for debugging. I have added my plugin in a GitHub repository for your investigation.
I am using it in my ionic 1 application. You can investigate with this code Cordova, ionic other versions also.
1. Install plugin
cordova plugin add https://github.com/haruncpi/cordova-native-dbxconnect.git
2. Add activity in platforms/android/AndroidManifest.xml file
<activity android:configChanges="orientation|keyboard" android:launchMode="singleTask" android:name="com.dropbox.core.android.AuthActivity"> <intent-filter> <data android:scheme="db-here_your_app_key" /> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>[N.B: Must change here_your_app_key with your app key]
3. Use in your js side
cordova.plugins.DbxConnect.dbxAuth(here_your_app_key, function (token) { console.log(token) }, function (error) { console.log(error) })[N.B: Must change here_your_app_key with your app key]
I hope I'll get a solution asap. My app users getting a bad experience with this issue.
- Greg-DB7 years ago
Dropbox Community Moderator
Nothing in the code you've provided so far looks problematic.
Unfortunately Cordova isn't officially supported by Dropbox though, so I'm afraid I don't have experience using it. Can you share a complete sample including all of the code necessary so we can reproduce this?
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!