AccountManager.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.
Overloads
| GetAuthToken(Account, String, Boolean, IAccountManagerCallback, Handler) |
Obsolete.
Gets an auth token of the specified type for a particular account, optionally raising a notification if the user must enter credentials. |
| GetAuthToken(Account, String, Bundle, Activity, IAccountManagerCallback, Handler) |
Gets an auth token of the specified type for a particular account, prompting the user for credentials if necessary. |
| GetAuthToken(Account, String, Bundle, Boolean, IAccountManagerCallback, Handler) |
Gets an auth token of the specified type for a particular account, optionally raising a notification if the user must enter credentials. |
GetAuthToken(Account, String, Boolean, IAccountManagerCallback, Handler)
Caution
deprecated
Gets an auth token of the specified type for a particular account, optionally raising a notification if the user must enter credentials.
[Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_ZLandroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")]
[Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")]
[System.Obsolete("deprecated")]
public virtual Android.Accounts.IAccountManagerFuture? GetAuthToken (Android.Accounts.Account? account, string? authTokenType, bool notifyAuthFailure, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_ZLandroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")>]
[<System.Obsolete("deprecated")>]
abstract member GetAuthToken : Android.Accounts.Account * string * bool * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.GetAuthToken : Android.Accounts.Account * string * bool * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
Parameters
- account
- Account
The account to fetch an auth token for
- authTokenType
- String
The auth token type, an authenticator-dependent string token, must not be null
- notifyAuthFailure
- Boolean
True to add a notification to prompt the user for a password if necessary, false to leave that to the caller
- callback
- IAccountManagerCallback
Callback to invoke when the request completes, null for no callback
- handler
- Handler
Handler identifying the callback thread,
null for the main thread
Returns
An AccountManagerFuture which resolves to a Bundle with
at least the following fields on success:
<ul>
<li> #KEY_ACCOUNT_NAME - the name of the account you supplied
<li> #KEY_ACCOUNT_TYPE - the type of the account
<li> #KEY_AUTHTOKEN - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If the user
must enter credentials, the returned Bundle contains only
<code data-dev-comment-type="c">#KEY_INTENT</code> with the <code data-dev-comment-type="c">Intent</code> needed to launch a prompt.
If an error occurred, <code data-dev-comment-type="c">AccountManagerFuture#getResult()</code> throws:
<ul>
<li> <code data-dev-comment-type="c">AuthenticatorException</code> if the authenticator failed to respond
<li> <code data-dev-comment-type="c">OperationCanceledException</code> if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> <code data-dev-comment-type="c">IOException</code> if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
- Attributes
Remarks
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
GetAuthToken(Account, String, Bundle, Activity, IAccountManagerCallback, Handler)
Gets an auth token of the specified type for a particular account, prompting the user for credentials if necessary.
[Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")]
[Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")]
public virtual Android.Accounts.IAccountManagerFuture? GetAuthToken (Android.Accounts.Account? account, string? authTokenType, Android.OS.Bundle? options, Android.App.Activity? activity, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;Landroid/app/Activity;Landroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_Landroid_app_Activity_Landroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")>]
abstract member GetAuthToken : Android.Accounts.Account * string * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.GetAuthToken : Android.Accounts.Account * string * Android.OS.Bundle * Android.App.Activity * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
Parameters
- account
- Account
The account to fetch an auth token for
- authTokenType
- String
The auth token type, an authenticator-dependent string token, must not be null
- options
- Bundle
Authenticator-specific options for the request, may be null or empty
- activity
- Activity
The Activity context to use for launching a new
authenticator-defined sub-Activity to prompt the user for a password
if necessary; used only to call startActivity(); must not be null.
- callback
- IAccountManagerCallback
Callback to invoke when the request completes, null for no callback
- handler
- Handler
Handler identifying the callback thread,
null for the main thread
Returns
An AccountManagerFuture which resolves to a Bundle with
at least the following fields:
<ul>
<li> #KEY_ACCOUNT_NAME - the name of the account you supplied
<li> #KEY_ACCOUNT_TYPE - the type of the account
<li> #KEY_AUTHTOKEN - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If an auth token
could not be fetched, <code data-dev-comment-type="c">AccountManagerFuture#getResult()</code> throws:
<ul>
<li> <code data-dev-comment-type="c">AuthenticatorException</code> if the authenticator failed to respond
<li> <code data-dev-comment-type="c">OperationCanceledException</code> if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> <code data-dev-comment-type="c">IOException</code> if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
- Attributes
Remarks
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
GetAuthToken(Account, String, Bundle, Boolean, IAccountManagerCallback, Handler)
Gets an auth token of the specified type for a particular account, optionally raising a notification if the user must enter credentials.
[Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_ZLandroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")]
[Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")]
public virtual Android.Accounts.IAccountManagerFuture? GetAuthToken (Android.Accounts.Account? account, string? authTokenType, Android.OS.Bundle? options, bool notifyAuthFailure, Android.Accounts.IAccountManagerCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("getAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Landroid/os/Bundle;ZLandroid/accounts/AccountManagerCallback;Landroid/os/Handler;)Landroid/accounts/AccountManagerFuture;", "GetGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_Landroid_os_Bundle_ZLandroid_accounts_AccountManagerCallback_Landroid_os_Handler_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")>]
abstract member GetAuthToken : Android.Accounts.Account * string * Android.OS.Bundle * bool * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
override this.GetAuthToken : Android.Accounts.Account * string * Android.OS.Bundle * bool * Android.Accounts.IAccountManagerCallback * Android.OS.Handler -> Android.Accounts.IAccountManagerFuture
Parameters
- account
- Account
The account to fetch an auth token for
- authTokenType
- String
The auth token type, an authenticator-dependent string token, must not be null
- options
- Bundle
Authenticator-specific options for the request, may be null or empty
- notifyAuthFailure
- Boolean
True to add a notification to prompt the user for a password if necessary, false to leave that to the caller
- callback
- IAccountManagerCallback
Callback to invoke when the request completes, null for no callback
- handler
- Handler
Handler identifying the callback thread,
null for the main thread
Returns
An AccountManagerFuture which resolves to a Bundle with
at least the following fields on success:
<ul>
<li> #KEY_ACCOUNT_NAME - the name of the account you supplied
<li> #KEY_ACCOUNT_TYPE - the type of the account
<li> #KEY_AUTHTOKEN - the auth token you wanted
</ul>
(Other authenticator-specific values may be returned.) If the user
must enter credentials, the returned Bundle contains only
<code data-dev-comment-type="c">#KEY_INTENT</code> with the <code data-dev-comment-type="c">Intent</code> needed to launch a prompt.
If an error occurred, <code data-dev-comment-type="c">AccountManagerFuture#getResult()</code> throws:
<ul>
<li> <code data-dev-comment-type="c">AuthenticatorException</code> if the authenticator failed to respond
<li> <code data-dev-comment-type="c">OperationCanceledException</code> if the operation is canceled for
any reason, incluidng the user canceling a credential request
<li> <code data-dev-comment-type="c">IOException</code> if the authenticator experienced an I/O problem
creating a new auth token, usually because of network trouble
</ul>
If the account is no longer present on the device, the return value is
authenticator-dependent. The caller should verify the validity of the
account before requesting an auth token.
- Attributes
Remarks
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.