Reputation: 4232
I'm developing android app, using the Dropbox API on Android. The API has a link activity to link an account with the app.
I have the app key and app secret and the Dropbox account and the password, and I need to put this info in the code programmatically.
What I don't want is this login/link activity, assuming I have a Dropbox account and password and I want to link/authenticate programmatically with this particular account without demanding the user to link or login or input any account or password.
Can I do that?
Upvotes: 2
Views: 767
Reputation: 4232
well i found actually dropbox offered what i want to do .
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<AndroidAuthSession>(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
Upvotes: 1