If set, the subject token response will be parsed as JSON and the
value in the field with name SubjectTokenJsonFieldName
will be returned as the subject token.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eUrlSourcedExternalAccountCredential\u003c/code\u003e class is used for obtaining credentials from a URL, and is a type of \u003ccode\u003eExternalAccountCredential\u003c/code\u003e that inherits from \u003ccode\u003eServiceCredential\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements multiple interfaces such as \u003ccode\u003eIHttpUnsuccessfulResponseHandler\u003c/code\u003e, \u003ccode\u003eICredential\u003c/code\u003e, \u003ccode\u003eIConfigurableHttpClientInitializer\u003c/code\u003e, \u003ccode\u003eITokenAccessWithHeaders\u003c/code\u003e, \u003ccode\u003eITokenAccess\u003c/code\u003e, and \u003ccode\u003eIHttpExecuteInterceptor\u003c/code\u003e, for handling HTTP responses and managing tokens.\u003c/p\u003e\n"],["\u003cp\u003eIt provides properties like \u003ccode\u003eHeaders\u003c/code\u003e, \u003ccode\u003eSubjectTokenJsonFieldName\u003c/code\u003e, and \u003ccode\u003eSubjectTokenUrl\u003c/code\u003e for configuring how to retrieve and parse the subject token from the specified URL.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eGetSubjectTokenAsyncImpl\u003c/code\u003e method, which is overridden from the base class, is responsible for fetching the subject token that will be exchanged for the access token, utilizing a provided cancellation token.\u003c/p\u003e\n"],["\u003cp\u003eThis API has a few different versions available, with the most current one being version 1.69.0.\u003c/p\u003e\n"]]],[],null,["# Class UrlSourcedExternalAccountCredential (1.69.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.69.0 (latest)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential)\n- [1.68.0](/dotnet/docs/reference/Google.Apis/1.68.0/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential)\n- [1.60.0](/dotnet/docs/reference/Google.Apis/1.60.0/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential)\n- [1.59.0](/dotnet/docs/reference/Google.Apis/1.59.0/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential)\n- [1.55.0](/dotnet/docs/reference/Google.Apis/1.55.0/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential)\n- [1.50.0](/dotnet/docs/reference/Google.Apis/1.50.0/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential) \n\n public sealed class UrlSourcedExternalAccountCredential : ExternalAccountCredential, IHttpUnsuccessfulResponseHandler, ICredential, IConfigurableHttpClientInitializer, ITokenAccessWithHeaders, ITokenAccess, IHttpExecuteInterceptor\n\nURL-sourced credentials as described in\n\u003chttps://google.aip.dev/auth/4117#determining-the-subject-token-in-microsoft-azure-and-url-sourced-credentials\u003e. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e [ServiceCredential](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential) \\\u003e [ExternalAccountCredential](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential) \\\u003e UrlSourcedExternalAccountCredential \n\nImplements\n----------\n\n[IHttpUnsuccessfulResponseHandler](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpUnsuccessfulResponseHandler), [ICredential](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ICredential), [IConfigurableHttpClientInitializer](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IConfigurableHttpClientInitializer), [ITokenAccessWithHeaders](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ITokenAccessWithHeaders), [ITokenAccess](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ITokenAccess), [IHttpExecuteInterceptor](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Http.IHttpExecuteInterceptor) \n\nInherited Members\n-----------------\n\n[ExternalAccountCredential.Audience](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_Audience) \n[ExternalAccountCredential.SubjectTokenType](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_SubjectTokenType) \n[ExternalAccountCredential.ServiceAccountImpersonationUrl](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_ServiceAccountImpersonationUrl) \n[ExternalAccountCredential.WorkforcePoolUserProject](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_WorkforcePoolUserProject) \n[ExternalAccountCredential.ClientId](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_ClientId) \n[ExternalAccountCredential.ClientSecret](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_ClientSecret) \n[ExternalAccountCredential.UniverseDomain](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_UniverseDomain) \n[ExternalAccountCredential.RequestAccessTokenAsync(CancellationToken)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_RequestAccessTokenAsync_System_Threading_CancellationToken_) \n[ServiceCredential.TokenServerUrl](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_TokenServerUrl) \n[ServiceCredential.Clock](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_Clock) \n[ServiceCredential.AccessMethod](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_AccessMethod) \n[ServiceCredential.HttpClient](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_HttpClient) \n[ServiceCredential.Scopes](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_Scopes) \n[ServiceCredential.Token](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_Token) \n[ServiceCredential.QuotaProject](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_QuotaProject) \n[ServiceCredential.Initialize(ConfigurableHttpClient)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_Initialize_Google_Apis_Http_ConfigurableHttpClient_) \n[ServiceCredential.InterceptAsync(HttpRequestMessage, CancellationToken)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_InterceptAsync_System_Net_Http_HttpRequestMessage_System_Threading_CancellationToken_) \n[ServiceCredential.HandleResponseAsync(HandleUnsuccessfulResponseArgs)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_HandleResponseAsync_Google_Apis_Http_HandleUnsuccessfulResponseArgs_) \n[ServiceCredential.GetAccessTokenForRequestAsync(string, CancellationToken)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_GetAccessTokenForRequestAsync_System_String_System_Threading_CancellationToken_) \n[ServiceCredential.GetAccessTokenWithHeadersForRequestAsync(string, CancellationToken)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ServiceCredential#Google_Apis_Auth_OAuth2_ServiceCredential_GetAccessTokenWithHeadersForRequestAsync_System_String_System_Threading_CancellationToken_) \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)) \n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Apis.Auth.OAuth2](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2)\n\nAssembly\n--------\n\nGoogle.Apis.Auth.dll\n\nProperties\n----------\n\n### Headers\n\n public IReadOnlyDictionary\u003cstring, string\u003e Headers { get; }\n\nHeaders to include in the request for the subject token.\nMay be empty. Will not be null.\n\n### SubjectTokenJsonFieldName\n\n public string SubjectTokenJsonFieldName { get; }\n\nIf set, the subject token response will be parsed as JSON and the\nvalue in the field with name [SubjectTokenJsonFieldName](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.UrlSourcedExternalAccountCredential#Google_Apis_Auth_OAuth2_UrlSourcedExternalAccountCredential_SubjectTokenJsonFieldName)\nwill be returned as the subject token.\n\n### SubjectTokenUrl\n\n public string SubjectTokenUrl { get; }\n\nThe URL from which to obtain the subject token.\n\nMethods\n-------\n\n### GetSubjectTokenAsyncImpl(CancellationToken)\n\n protected override Task\u003cstring\u003e GetSubjectTokenAsyncImpl(CancellationToken taskCancellationToken)\n\nGets the subject token to be exchanged for the access token.\n\n**Overrides** \n[ExternalAccountCredential.GetSubjectTokenAsyncImpl(CancellationToken)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.OAuth2.ExternalAccountCredential#Google_Apis_Auth_OAuth2_ExternalAccountCredential_GetSubjectTokenAsyncImpl_System_Threading_CancellationToken_)\n\nExtension Method\n----------------\n\n[Utilities.ThrowIfNull\\\u003cT\\\u003e(T, string)](/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Util.Utilities#Google_Apis_Util_Utilities_ThrowIfNull__1___0_System_String_)"]]