Send feedback
  
   
 
  
    
      Class IdentityPoolCredentials.Builder (1.40.0)
    
    
      
      
      Stay organized with collections
     
    
      
      Save and categorize content based on your preferences.
     
    
  
  
   
  
    
  
  
    
    
    
    
  Version latestkeyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   static   class  IdentityPoolCredentials . Builder   extends   ExternalAccountCredentials . Builder  
  
  
  Methods
   
  build() 
  
    
public   IdentityPoolCredentials   build ()  
  
  Overrides 
  
  setAudience(String audience) 
  
    
public   IdentityPoolCredentials . Builder   setAudience ( String   audience )  
  Sets the Security Token Service audience, which is usually the fully specified resource name
 of the workload/workforce pool provider.
    
      
        Parameter  
      
        Name Description  
      
        audienceString  
     
  
  
  Overrides 
  
  setClientId(String clientId) 
  
    
public   IdentityPoolCredentials . Builder   setClientId ( String   clientId )  
  Sets the optional client ID of the service account from the console.
    
      
        Parameter  
      
        Name Description  
      
        clientIdString  
     
  
  
  Overrides 
  
  setClientSecret(String clientSecret) 
  
    
public   IdentityPoolCredentials . Builder   setClientSecret ( String   clientSecret )  
  Sets the optional client secret of the service account from the console.
    
      
        Parameter  
      
        Name Description  
      
        clientSecretString  
     
  
  
  Overrides 
  
  setCredentialSource(IdentityPoolCredentialSource credentialSource) 
  
    
public   IdentityPoolCredentials . Builder   setCredentialSource ( IdentityPoolCredentialSource   credentialSource )  
  
  
  setHttpTransportFactory(HttpTransportFactory transportFactory) 
  
    
public   IdentityPoolCredentials . Builder   setHttpTransportFactory ( HttpTransportFactory   transportFactory )  
  Sets the HTTP transport factory, creates the transport used to get access tokens.
Overrides 
  
  setQuotaProjectId(String quotaProjectId) 
  
    
public   IdentityPoolCredentials . Builder   setQuotaProjectId ( String   quotaProjectId )  
  Sets the optional project used for quota and billing purposes.
    
      
        Parameter  
      
        Name Description  
      
        quotaProjectIdString  
     
  
  
  Overrides 
  
  setScopes(Collection<String> scopes) 
  
    
public   IdentityPoolCredentials . Builder   setScopes ( Collection<String>   scopes )  
  Sets the optional scopes to request during the authorization grant.
Overrides 
  
  setServiceAccountImpersonationOptions(Map<String,Object> optionsMap) 
  
    
public   IdentityPoolCredentials . Builder   setServiceAccountImpersonationOptions ( Map<String , Object >  optionsMap )  
  Sets the optional service account impersonation options.
Overrides 
  
  setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl) 
  
    
public   IdentityPoolCredentials . Builder   setServiceAccountImpersonationUrl ( String   serviceAccountImpersonationUrl )  
  Sets the optional URL used for service account impersonation, which is required for some
 APIs. If this URL is not available, the access token from the Security Token Service is used
 directly.
    
      
        Parameter  
      
        Name Description  
      
        serviceAccountImpersonationUrlString  
     
  
  
  Overrides 
  
  setSubjectTokenSupplier(IdentityPoolSubjectTokenSupplier subjectTokenSupplier) 
  
    
public   IdentityPoolCredentials . Builder   setSubjectTokenSupplier ( IdentityPoolSubjectTokenSupplier   subjectTokenSupplier )  
  Sets the subject token supplier. The supplier should return a valid subject token string.
setSubjectTokenType(ExternalAccountCredentials.SubjectTokenTypes subjectTokenType) 
  
    
public   IdentityPoolCredentials . Builder   setSubjectTokenType ( ExternalAccountCredentials . SubjectTokenTypes   subjectTokenType )  
  Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange
 spec. Indicates the type of the security token in the credential file.
Overrides 
  
  setSubjectTokenType(String subjectTokenType) 
  
    
public   IdentityPoolCredentials . Builder   setSubjectTokenType ( String   subjectTokenType )  
  Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange
 spec. Indicates the type of the security token in the credential file.
    
      
        Parameter  
      
        Name Description  
      
        subjectTokenTypeString  
     
  
  
  Overrides 
  
  setTokenInfoUrl(String tokenInfoUrl) 
  
    
public   IdentityPoolCredentials . Builder   setTokenInfoUrl ( String   tokenInfoUrl )  
  Sets the optional endpoint used to retrieve account related information. Required for gCloud
 session account identification.
    
      
        Parameter  
      
        Name Description  
      
        tokenInfoUrlString  
     
  
  
  Overrides 
  
  setTokenUrl(String tokenUrl) 
  
    
public   IdentityPoolCredentials . Builder   setTokenUrl ( String   tokenUrl )  
  Sets the Security Token Service token exchange endpoint.
    
      
        Parameter  
      
        Name Description  
      
        tokenUrlString  
     
  
  
  Overrides 
  
  setUniverseDomain(String universeDomain) 
  
    
public   IdentityPoolCredentials . Builder   setUniverseDomain ( String   universeDomain )  
  Sets the optional universe domain.
    
      
        Parameter  
      
        Name Description  
      
        universeDomainString  
     
  
  
  Overrides 
  
  setWorkforcePoolUserProject(String workforcePoolUserProject) 
  
    
public   IdentityPoolCredentials . Builder   setWorkforcePoolUserProject ( String   workforcePoolUserProject )  
  Sets the optional workforce pool user project number when the credential corresponds to a
 workforce pool and not a workload identity pool. The underlying principal must still have
 serviceusage.services.use IAM permission to use the project for billing/quota.
    
      
        Parameter  
      
        Name Description  
      
        workforcePoolUserProjectString  
     
  
  
  Overrides 
  
 
     
    
  
  
  
     
  
    
    
      
    
     
  
       
         
  
  
    
    Send feedback
  
   
 
       
    
    
  
  
 
  Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License . For details, see the Google Developers Site Policies . Java is a registered trademark of Oracle and/or its affiliates.
  Last updated 2025-10-15 UTC.
 
 
  
  
    
    
    
      
  
  
    Need to tell us more?
  
   
 
     
  
  
    
      [[["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-10-15 UTC."],[],[]]