简体   繁体   English

从Android中的Accountmanager获取Dropbox帐户的身份验证令牌

[英]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 accountManager.getAuthToken(account, "DROPBOX",null,Hello.this, new GetAuthTokenCallback(), null);//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). 我得到了与此(一个不同的authtokentype)的google帐户的authtoken。 What i am missing. 我所缺少的。 I am not sure about the authTokenType parameter for dropbox. 我不确定保管箱的authTokenType参数。 Also are there any other parameter specific for dropbox like the bundle parameter that i am missing. 还有没有其他特定于Dropbox的参数,例如我缺少的bundle参数。 Is this way possible for dropbox? 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 链接: 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(). 我假设由于我们能够在android Accounts和Sync(Settings)中创建一个保管箱帐户,因此必须有一个保管箱验证器,该验证器具有AbstractAccountAuthenticator中实现的所有功能,包括getAuthToken()。 So dropbox should support giving auth token i think. 所以我认为Dropbox应该支持提供身份验证令牌。

  2. Also dropbox uses oauth1, whereas account manager uses outh 2.0. Dropbox也使用oauth1,而帐户管理器使用outh 2.0。 So is this an issue.Can anyone comment on this? 这是一个问题吗,有人可以对此发表评论吗?

EDIT: UPADATE 2 doesnot come into picture at all. 编辑:UPADATE 2完全不显示图片。 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. 我认为这与oauth1或2无关。这仅仅是服务提供商是否通过帐户管理器公开了auth,正如Nikolay所指出的那样。 (Coz i did this for twitter that uses oauth1.0) (Coz,我对使用oauth1.0的Twitter做到了这一点)

So is there anyone who has successfully got auth for dropbox via account manager?? 那么有没有人通过帐户管理器成功获得Dropbox的身份验证?

AFAIK, Dropbox uses OAuth. AFAIK,Dropbox使用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. 除非他们证明自己的帐户提供商能够为您提供OAuth令牌,否则您尝试执行的操作将不会起作用。 The 'authToken' parameter is account provider specific, that is why there is no list of values in the API reference. “ authToken”参数是特定于帐户提供者的,这就是API引用中没有值列表的原因。 Refer to Dropbox API manuals, if any. 请参阅Dropbox API手册(如果有)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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