简体   繁体   中英

Getting auth token for dropbox account from accountmanager in android

I am trying to get auth token for a dropbox account configured in device from account manager. I am using

accountManager.getAuthToken(account, "DROPBOX",null,Hello.this, new GetAuthTokenCallback(), null);//account" is dropbox account

I am seeing a Allow/Deny page. I click on Allow, but the callback is not getting invoked at all and i dont get the auth token. I got the authtoken for a google account with this(with a different authtokentype). What i am missing. I am not sure about the authTokenType parameter for dropbox. Also are there any other parameter specific for dropbox like the bundle parameter that i am missing. Is this way possible for dropbox?

Check below for the function parameters

public AccountManagerFuture<Bundle> getAuthToken (Account account, String authTokenType, Bundle options, Activity activity, AccountManagerCallback<Bundle> callback, Handler handler)

Link: http://developer.android.com/reference/android/accounts/AccountManager.html

UPDATE

  1. I assume since we are able to create a dropbox account in android Accounts and Sync(Settings), there must be a dropbox authenticator that has all the functions in AbstractAccountAuthenticator implemented including getAuthToken(). So dropbox should support giving auth token i think.

  2. Also dropbox uses oauth1, whereas account manager uses outh 2.0. So is this an issue.Can anyone comment on this?

EDIT: UPADATE 2 doesnot come into picture at all. I think it is not about oauth1 or 2. Its just whether the service provider has exposed auth through account manager or not as Nikolay pointed. (Coz i did this for twitter that uses oauth1.0)

So is there anyone who has successfully got auth for dropbox via account manager??

AFAIK, Dropbox uses OAuth. Unless they document somewhere that their account provider is able to give you OAuth tokens, what you are trying to do won't work. The 'authToken' parameter is account provider specific, that is why there is no list of values in the API reference. Refer to Dropbox API manuals, if any.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM