【发布时间】:2011-07-28 09:31:43
【问题描述】:
我的应用程序连接到使用 OAuth 授权的服务器。 我应该如何在账户管理器中存储这些账户? 如果我已经登录并通过,它可能如下所示:
Account account = new Account("user1", context.getString(R.string.ACCOUNT_TYPE));
AccountManager am = AccountManager.get(context);
if (am.addAccountExplicitly(account, "pass1", null)) {
result = new Bundle();
Log.i(TAG, "account: "+account.name+", "+account.type);
result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
result.putString(AccountManager.KEY_ACCOUNT_TYPE, account.type);
activity.setAccountAuthenticatorResult(result);
但是在 OAuth 帐户的情况下应该传递什么而不是用户名并传递? 我应该在哪里存储 OAuth-secret? OAuth 令牌应该存储在 KEY_AUTHTOKEN 中吗?
【问题讨论】:
标签: android oauth accountmanager