Search in sources :

Example 1 with AccessTokenPair

use of com.dropbox.client2.session.AccessTokenPair in project Aegis by Decad3nce.

the class BackupDropboxAccountsActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    Log.e(TAG, "Resuming");
    if (mDBApi.getSession().authenticationSuccessful() && !isLoggedIn) {
        try {
            Log.e(TAG, "Authentication was successful");
            mDBApi.getSession().finishAuthentication();
            AccessTokenPair tokens = mDBApi.getSession().getAccessTokenPair();
            storeKeys(tokens.key, tokens.secret);
            Log.e(TAG, "Storing keys");
            isLoggedIn = true;
            Intent intent = getIntent();
            if (!(intent.hasExtra("fromReceiver"))) {
                finish();
            }
        } catch (IllegalStateException e) {
            Log.i("DbAuthLog", "Error authenticating", e);
        }
    } else {
    }
}
Also used : AccessTokenPair(com.dropbox.client2.session.AccessTokenPair) Intent(android.content.Intent)

Example 2 with AccessTokenPair

use of com.dropbox.client2.session.AccessTokenPair in project Aegis by Decad3nce.

the class BackupDropboxAccountsActivity method buildSession.

private AndroidAuthSession buildSession() {
    AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET);
    AndroidAuthSession session;
    String[] stored = getStoredKeys();
    if (stored != null) {
        Log.e(TAG, "Auth keys were stored, recovering");
        AccessTokenPair accessToken = new AccessTokenPair(stored[0], stored[1]);
        session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE, accessToken);
    } else {
        Log.e(TAG, "Auth keys were not stored");
        session = new AndroidAuthSession(appKeyPair, ACCESS_TYPE);
    }
    return session;
}
Also used : AndroidAuthSession(com.dropbox.client2.android.AndroidAuthSession) AccessTokenPair(com.dropbox.client2.session.AccessTokenPair) AppKeyPair(com.dropbox.client2.session.AppKeyPair)

Example 3 with AccessTokenPair

use of com.dropbox.client2.session.AccessTokenPair in project skype-bot by toomasr.

the class DropboxDirPluginFileRepository method initDropboxApi.

private void initDropboxApi() {
    AppKeyPair appKeys = new AppKeyPair(Configuration.getProperty("dropbox.appkey"), Configuration.getProperty("dropbox.appsecret"));
    WebAuthSession session = new WebAuthSession(appKeys, AccessType.DROPBOX, new AccessTokenPair(Configuration.getProperty("dropbox.token.key"), Configuration.getProperty("dropbox.token.secret")));
    api = new DropboxAPI<WebAuthSession>(session);
}
Also used : WebAuthSession(com.dropbox.client2.session.WebAuthSession) AccessTokenPair(com.dropbox.client2.session.AccessTokenPair) AppKeyPair(com.dropbox.client2.session.AppKeyPair)

Aggregations

AccessTokenPair (com.dropbox.client2.session.AccessTokenPair)3 AppKeyPair (com.dropbox.client2.session.AppKeyPair)2 Intent (android.content.Intent)1 AndroidAuthSession (com.dropbox.client2.android.AndroidAuthSession)1 WebAuthSession (com.dropbox.client2.session.WebAuthSession)1