Search in sources :

Example 1 with DbxSessionStore

use of com.dropbox.core.DbxSessionStore in project dropbox-webhooks-spring-boot-example by zeldan.

the class DropboxService method finishAuthAndSaveUserDetails.

public void finishAuthAndSaveUserDetails(final HttpSession session, final Map<String, String[]> parameterMap) throws Exception {
    final DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, dropboxConfigProp.getSessionStore().getKey());
    final DbxAuthFinish authFinish = auth.finishFromRedirect(dropboxConfigProp.getRedirectUri(), csrfTokenStore, parameterMap);
    final String accessToken = authFinish.getAccessToken();
    final DbxClientV2 client = new DbxClientV2(requestConfig, accessToken);
    final String userId = authFinish.getUserId();
    final ListFolderResult listFolderResult = client.files().listFolderBuilder("").withRecursive(true).start();
    saveAccessTokenAndActualCursor(userId, accessToken, listFolderResult);
}
Also used : DbxSessionStore(com.dropbox.core.DbxSessionStore) DbxClientV2(com.dropbox.core.v2.DbxClientV2) ListFolderResult(com.dropbox.core.v2.files.ListFolderResult) DbxAuthFinish(com.dropbox.core.DbxAuthFinish) DbxStandardSessionStore(com.dropbox.core.DbxStandardSessionStore)

Example 2 with DbxSessionStore

use of com.dropbox.core.DbxSessionStore in project dropbox-webhooks-spring-boot-example by zeldan.

the class DropboxService method startAuth.

public String startAuth(final HttpSession session) {
    final DbxSessionStore csrfTokenStore = new DbxStandardSessionStore(session, dropboxConfigProp.getSessionStore().getKey());
    final DbxWebAuth.Request authRequest = DbxWebAuth.newRequestBuilder().withRedirectUri(dropboxConfigProp.getRedirectUri(), csrfTokenStore).build();
    return auth.authorize(authRequest);
}
Also used : DbxSessionStore(com.dropbox.core.DbxSessionStore) DbxStandardSessionStore(com.dropbox.core.DbxStandardSessionStore) DbxWebAuth(com.dropbox.core.DbxWebAuth)

Aggregations

DbxSessionStore (com.dropbox.core.DbxSessionStore)2 DbxStandardSessionStore (com.dropbox.core.DbxStandardSessionStore)2 DbxAuthFinish (com.dropbox.core.DbxAuthFinish)1 DbxWebAuth (com.dropbox.core.DbxWebAuth)1 DbxClientV2 (com.dropbox.core.v2.DbxClientV2)1 ListFolderResult (com.dropbox.core.v2.files.ListFolderResult)1