Show / Hide Table of Contents

Method GetCredentialAsync

GetCredentialAsync(CredentialRequestInfo, Boolean)

Obtains a Credential of the specified AuthenticationType that can be used to access the secured resource identified by the ServiceUri. If required, the ChallengeHandler will be called to prompt for credentials. In case of Token, the user is typically challenged for a username and password which are used to generate a token. This method is called internally when a network request fails with an authentication error.

Declaration
public Task<Credential> GetCredentialAsync(CredentialRequestInfo credentialRequestInfo, bool retry)
Parameters
Type Name Description
CredentialRequestInfo credentialRequestInfo

The information about the credential to get.

System.Boolean retry

Indicates whether this method is being called after the first attempt to authenticate failed. This parameter affects behavior when a credential of matching AuthenticationType already exists for the given URL. When false, existing credential is assumed to be valid and may be returned unless it expired. When true, existing credential is assumed to be invalid and will be removed from Credentials; the ChallengeHandler will then be called to obtain a replacement credential.

Returns
Type Description
System.Threading.Tasks.Task<Credential>

A task object representing the asynchronous get credential operation. The value of the task result is a Credential object. The result will be null if credential request was canceled or if ChallengeHandler did not produce a credential.

Applies to

Platforms and versions
TargetVersions
.NET Standard 2.0100.3 - 200.8
.NET100.13 - 200.8
.NET Windows100.13 - 200.8
.NET Android200.0 - 200.8
.NET iOS200.0 - 200.8
.NET Framework100.0 - 200.8
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.8
In This Article
Back to top Copyright © 2022 Esri.