Allow Dropbox API to access my account on user's device

前端 未结 3 2043
無奈伤痛
無奈伤痛 2020-12-16 20:53

As a mobile developer, I\'m looking for a solution that allows users of my application to download multiple .zip files that will add a \"modular\" feel to my application. I\

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 21:02

    Some time passed, but now dropbox will let you generate public access token and use it inside your code

    so yes , there is a way to allow permanent access to dropbox API. we need to generate access token from the application settings(dropbox console) and use it. Here is what dropbox says:

    By generating an access token, you will be able to make API calls for your own account without going through the authorization flow. To obtain access tokens for other users, use the standard OAuth flow.

    in code words :

    AndroidAuthSession session = buildSession();
    mApi = new DropboxAPI(session);
    
        private AndroidAuthSession buildSession() {
            AppKeyPair appKeyPair = new AppKeyPair(APP_KEY, APP_SECRET);
            AndroidAuthSession session = new AndroidAuthSession(appKeyPair, ACCESS_TOKEN);
            // I guess then you just have to instantiate a DropboxAPI object and you're good to go without the startAuthentication()... endAuthentication() etc.
            return session;
        }
    

    and here we go just use the mApi to do whatever you want

提交回复
热议问题