Start 2025 on time and up to date. Seamlessly integrate your calendars into Dropbox with these simple steps.

Forum Discussion

silent10's avatar
silent10
Explorer | Level 4
8 years ago

Access Token is invalid in android

I am creating a OAuth2AccessToken and storing it in shared preferences. The session is successful till the app is closed. It is invalid after I open the app again. This is the code I am using to create a new session using the stored access token.

 

String dropboxaccesstoken = sharedpreferencessam.getString("dropboxaccesstoken", ""); // getting Boolean
Log.d("dropboxaccesstoken","token is: " + dropboxaccesstoken);
AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
AndroidAuthSession session = new AndroidAuthSession(appKeys,dropboxaccesstoken);
//session.setOAuth2AccessToken(dropboxaccesstoken);
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
Log.d("(at successful or not", Boolean.toString((mDBApi.getSession().authenticationSuccessful())));

 
Logcat:

03-17 02:47:27.119 22706-23044/com.audiorecorder.wel.voicerecorder D/dropboxaccesstoken: token is: <ACCESS_TOKEN_REDACTED>
03-17 02:47:27.145 22706-23044/com.audiorecorder.wel.voicerecorder D/(at successful or not: false

Can someone help me on this please.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,927 PostsLatest Activity: 3 hours ago
337 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!