Send feedback
  
   
 
  
    
      Class ServiceAccountCredentials.Builder (1.40.0) 
  
  
  
   
  
    
  
  
    
    
    
    
    
  Version latestkeyboard_arrow_down  
  
 
    
    
    
    
      
  
  
  
    
public   static   class  ServiceAccountCredentials . Builder   extends   GoogleCredentials . Builder  
  
  
  Constructors
   
  Builder() 
  
  Builder(ServiceAccountCredentials credentials) 
  
    
protected   Builder ( ServiceAccountCredentials   credentials )  
  
  Methods
   
  build() 
  
    
public   ServiceAccountCredentials   build ()  
  
  Overrides 
  
  getClientEmail() 
  
    
public   String   getClientEmail ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getClientId() 
  
    
public   String   getClientId ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getDefaultScopes() 
  
    
public   Collection<String>   getDefaultScopes ()  
  
  getHttpTransportFactory() 
  
    
public   HttpTransportFactory   getHttpTransportFactory ()  
  
  getLifetime() 
  
  
    
      
        Returns  
      
        Type Description  
      
        int  
     
  
  getPrivateKey() 
  
    
public   PrivateKey   getPrivateKey ()  
  
  getPrivateKeyId() 
  
    
public   String   getPrivateKeyId ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getProjectId() 
  
    
public   String   getProjectId ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getScopes() 
  
    
public   Collection<String>   getScopes ()  
  
  getServiceAccountUser() 
  
    
public   String   getServiceAccountUser ()  
  
    
      
        Returns  
      
        Type Description  
      
        String  
     
  
  getTokenServerUri() 
  
    
public   URI   getTokenServerUri ()  
  
    
      
        Returns  
      
        Type Description  
      
        URI  
     
  
  getUseJwtAccessWithScope() 
  
    
public   boolean   getUseJwtAccessWithScope ()  
  
  isDefaultRetriesEnabled() 
  
    
public   boolean   isDefaultRetriesEnabled ()  
  
  setClientEmail(String clientEmail) 
  
    
public   ServiceAccountCredentials . Builder   setClientEmail ( String   clientEmail )  
  
    
      
        Parameter  
      
        Name Description  
      
        clientEmailString  
     
  
  
  setClientId(String clientId) 
  
    
public   ServiceAccountCredentials . Builder   setClientId ( String   clientId )  
  
    
      
        Parameter  
      
        Name Description  
      
        clientIdString  
     
  
  
  setDefaultRetriesEnabled(boolean defaultRetriesEnabled) 
  
    
public   ServiceAccountCredentials . Builder   setDefaultRetriesEnabled ( boolean   defaultRetriesEnabled )  
  
    
      
        Parameter  
      
        Name Description  
      
        defaultRetriesEnabledboolean  
     
  
  
  setHttpTransportFactory(HttpTransportFactory transportFactory) 
  
    
public   ServiceAccountCredentials . Builder   setHttpTransportFactory ( HttpTransportFactory   transportFactory )  
  
  
  setLifetime(int lifetime) 
  
    
public   ServiceAccountCredentials . Builder   setLifetime ( int   lifetime )  
  
    
      
        Parameter  
      
        Name Description  
      
        lifetimeint  
     
  
  
  setPrivateKey(PrivateKey privateKey) 
  
    
public   ServiceAccountCredentials . Builder   setPrivateKey ( PrivateKey   privateKey )  
  
  
  setPrivateKeyId(String privateKeyId) 
  
    
public   ServiceAccountCredentials . Builder   setPrivateKeyId ( String   privateKeyId )  
  
    
      
        Parameter  
      
        Name Description  
      
        privateKeyIdString  
     
  
  
  setPrivateKeyString(String privateKeyPkcs8) 
  
    
public   ServiceAccountCredentials . Builder   setPrivateKeyString ( String   privateKeyPkcs8 )  
  
    
      
        Parameter  
      
        Name Description  
      
        privateKeyPkcs8String  
     
  
  
  
  setProjectId(String projectId) 
  
    
public   ServiceAccountCredentials . Builder   setProjectId ( String   projectId )  
  
    
      
        Parameter  
      
        Name Description  
      
        projectIdString  
     
  
  
  setQuotaProjectId(String quotaProjectId) 
  
    
public   ServiceAccountCredentials . Builder   setQuotaProjectId ( String   quotaProjectId )  
  
    
      
        Parameter  
      
        Name Description  
      
        quotaProjectIdString  
     
  
  
  Overrides 
  
  setScopes(Collection<String> scopes) 
  
    
public   ServiceAccountCredentials . Builder   setScopes ( Collection<String>   scopes )  
  
  
  setScopes(Collection<String> scopes, Collection<String> defaultScopes) 
  
    
public   ServiceAccountCredentials . Builder   setScopes ( Collection<String>   scopes ,   Collection<String>   defaultScopes )  
  
  
  setServiceAccountUser(String serviceAccountUser) 
  
    
public   ServiceAccountCredentials . Builder   setServiceAccountUser ( String   serviceAccountUser )  
  
    
      
        Parameter  
      
        Name Description  
      
        serviceAccountUserString  
     
  
  
  setTokenServerUri(URI tokenServerUri) 
  
    
public   ServiceAccountCredentials . Builder   setTokenServerUri ( URI   tokenServerUri )  
  
    
      
        Parameter  
      
        Name Description  
      
        tokenServerUriURI  
     
  
  
  setUniverseDomain(String universeDomain) 
  
    
public   ServiceAccountCredentials . Builder   setUniverseDomain ( String   universeDomain )  
  
    
      
        Parameter  
      
        Name Description  
      
        universeDomainString  
     
  
  
  Overrides 
  
  setUseJwtAccessWithScope(boolean useJwtAccessWithScope) 
  
    
public   ServiceAccountCredentials . Builder   setUseJwtAccessWithScope ( boolean   useJwtAccessWithScope )  
  
  
    
      
        Parameter  
      
        Name Description  
      
        useJwtAccessWithScopeboolean  
     
  
  
 
     
    
  
  
  
     
  
    
    
      
       
         
  
  
    
    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."],[],[]]