I am building an android app where the user have to download pictures from Dropbox. However every time, the user has to authenticate himself. I want the application to save the details first time and no authentication needed afterwards. The codes are below:
protected void initialize_session(){
AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
AndroidAuthSession session = new AndroidAuthSession(appKeys);
mDBApi = new DropboxAPI<AndroidAuthSession>(session);
mDBApi.getSession().startOAuth2Authentication(Control_Gate.this);
}
protected void onResume() {
if (mDBApi.getSession().authenticationSuccessful()) {
try {
// Required to complete auth, sets the access token on the session
mDBApi.getSession().finishAuthentication();;
String accessToken = mDBApi.getSession().getOAuth2AccessToken();
} catch (IllegalStateException e) {
Log.i("DbAuthLog", "Error authenticating", e);
}
}
super.onResume();
}
This is for returning the user to the app. I know that the the solution must be in these two but I can't figure how to save the credentials.