AbstractAccountAuthenticator.GetAuthToken Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an authtoken for an account.
[Android.Runtime.Register("getAuthToken", "(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;", "GetGetAuthToken_Landroid_accounts_AccountAuthenticatorResponse_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_Handler")]
public abstract Android.OS.Bundle? GetAuthToken (Android.Accounts.AccountAuthenticatorResponse? response, Android.Accounts.Account? account, string? authTokenType, Android.OS.Bundle? options);
[<Android.Runtime.Register("getAuthToken", "(Landroid/accounts/AccountAuthenticatorResponse;Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;)Landroid/os/Bundle;", "GetGetAuthToken_Landroid_accounts_AccountAuthenticatorResponse_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_Handler")>]
abstract member GetAuthToken : Android.Accounts.AccountAuthenticatorResponse * Android.Accounts.Account * string * Android.OS.Bundle -> Android.OS.Bundle
Parameters
- response
- AccountAuthenticatorResponse
to send the result back to the AccountManager, will never be null
- account
- Account
the account whose credentials are to be retrieved, will never be null
- authTokenType
- String
the type of auth token to retrieve, will never be null
- options
- Bundle
a Bundle of authenticator-specific options. It always contains
AccountManager#KEY_CALLER_PID
and AccountManager#KEY_CALLER_UID
fields which will let authenticator know the identity of the caller.
Returns
a Bundle result or null if the result is to be returned via the response.
- Attributes
Exceptions
if the authenticator could not honor the request due to a network error
Remarks
Gets an authtoken for an account.
If not null
, the resultant Bundle
will contain different sets of keys depending on whether a token was successfully issued and, if not, whether one could be issued via some android.app.Activity
.
If a token cannot be provided without some additional activity, the Bundle should contain AccountManager#KEY_INTENT
with an associated Intent
. On the other hand, if there is no such activity, then a Bundle containing AccountManager#KEY_ERROR_CODE
and AccountManager#KEY_ERROR_MESSAGE
should be returned.
If a token can be successfully issued, the implementation should return the AccountManager#KEY_ACCOUNT_NAME
and AccountManager#KEY_ACCOUNT_TYPE
of the account associated with the token as well as the AccountManager#KEY_AUTHTOKEN
. In addition AbstractAccountAuthenticator
implementations that declare themselves android:customTokens=true
may also provide a non-negative #KEY_CUSTOM_TOKEN_EXPIRY
long value containing the expiration timestamp of the expiration time (in millis since the unix epoch), tokens will be cached in memory based on application's packageName/signature for however long that was specified.
Implementers should assume that tokens will be cached on the basis of account and authTokenType. The system may ignore the contents of the supplied options Bundle when determining to re-use a cached token. Furthermore, implementers should assume a supplied expiration time will be treated as non-binding advice.
Finally, note that for android:customTokens=false
authenticators, tokens are cached indefinitely until some client calls AccountManager#invalidateAuthToken(String,String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.