AccountManager.PeekAuthToken(Account, String) Method

Definition

Gets an auth token from the AccountManager's cache.

[Android.Runtime.Register("peekAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;)Ljava/lang/String;", "GetPeekAuthToken_Landroid_accounts_Account_Ljava_lang_String_Handler")]
[Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")]
public virtual string? PeekAuthToken (Android.Accounts.Account? account, string? authTokenType);
[<Android.Runtime.Register("peekAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;)Ljava/lang/String;", "GetPeekAuthToken_Landroid_accounts_Account_Ljava_lang_String_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.AUTHENTICATE_ACCOUNTS")>]
abstract member PeekAuthToken : Android.Accounts.Account * string -> string
override this.PeekAuthToken : Android.Accounts.Account * string -> string

Parameters

account
Account

The account for which an auth token is to be fetched. Cannot be null.

authTokenType
String

The type of auth token to fetch. Cannot be null.

Returns

The cached auth token for this account and type, or null if no auth token is cached, the account does not exist, or the user is locked

Attributes

Remarks

Gets an auth token from the AccountManager's cache. If no auth token is cached for this account, null will be returned -- a new auth token will not be generated, and the server will not be contacted. Intended for use by the authenticator, not directly by applications.

It is safe to call this method from the main thread.

This method requires the caller to have a signature match with the authenticator that manages the specified account.

<b>NOTE:</b> If targeting your app to work on API level 22 and before, AUTHENTICATE_ACCOUNTS permission and same UID as account's authenticator is needed for those platforms. See docs for this function in API level 22.

Java documentation for android.accounts.AccountManager.peekAuthToken(android.accounts.Account, java.lang.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.

Applies to