@@ -112,7 +112,7 @@ private ServiceAccountJwtAccessCredentials(
112112 privateKeyId ,
113113 null ,
114114 null ,
115- null );
115+ Credentials . GOOGLE_DEFAULT_UNIVERSE );
116116 }
117117
118118 /**
@@ -123,7 +123,8 @@ private ServiceAccountJwtAccessCredentials(
123123 * @param privateKey RSA private key object for the service account.
124124 * @param privateKeyId Private key identifier for the service account. May be null.
125125 * @param defaultAudience Audience to use if not provided by transport. May be null.
126- * @param universeDomain universe domain in the format some-domain.xyz.
126+ * @param universeDomain universe domain in the format some-domain.xyz. By default, sets it to
127+ * googleapis.com
127128 */
128129 private ServiceAccountJwtAccessCredentials (
129130 String clientId ,
@@ -140,7 +141,11 @@ private ServiceAccountJwtAccessCredentials(
140141 this .defaultAudience = defaultAudience ;
141142 this .credentialsCache = createCache ();
142143 this .quotaProjectId = quotaProjectId ;
143- this .universeDomain = universeDomain ;
144+ if (universeDomain == null || universeDomain .trim ().isEmpty ()) {
145+ this .universeDomain = Credentials .GOOGLE_DEFAULT_UNIVERSE ;
146+ } else {
147+ this .universeDomain = universeDomain ;
148+ }
144149 }
145150
146151 /**
@@ -234,7 +239,7 @@ public static ServiceAccountJwtAccessCredentials fromPkcs8(
234239 privateKeyId ,
235240 defaultAudience ,
236241 null ,
237- Credentials .GOOGLE_DEFAULT_UNIVERSE );
242+ Credentials .GOOGLE_DEFAULT_UNIVERSE );
238243 }
239244
240245 static ServiceAccountJwtAccessCredentials fromPkcs8 (
0 commit comments