@@ -76,11 +76,16 @@ final class FirebaseUserManager {
7676
7777 private static final String ID_TOOLKIT_URL =
7878 "https://identitytoolkit.googleapis.com/%s/projects/%s" ;
79+
80+ private static final String ID_TOOLKIT_ADMIN_URL =
81+ "https://identitytoolkit.googleapis.com/admin/%s/projects/%s" ;
82+
7983 private static final String ID_TOOLKIT_URL_EMULATOR =
8084 "http://%s/identitytoolkit.googleapis.com/%s/projects/%s" ;
8185
8286 private final String userMgtBaseUrl ;
8387 private final String idpConfigMgtBaseUrl ;
88+ private final String adminUrl ;
8489 private final JsonFactory jsonFactory ;
8590 private final AuthHttpClient httpClient ;
8691
@@ -102,7 +107,7 @@ private FirebaseUserManager(Builder builder) {
102107 this .userMgtBaseUrl = idToolkitUrlV1 + "/tenants/" + tenantId ;
103108 this .idpConfigMgtBaseUrl = idToolkitUrlV2 + "/tenants/" + tenantId ;
104109 }
105-
110+ this . adminUrl = getIdToolkitAdminUrl ( projectId , "v2" );
106111 this .httpClient = new AuthHttpClient (jsonFactory , builder .requestFactory );
107112 }
108113
@@ -113,6 +118,10 @@ private String getIdToolkitUrl(String projectId, String version) {
113118 return String .format (ID_TOOLKIT_URL , version , projectId );
114119 }
115120
121+ private String getIdToolkitAdminUrl (String projectId , String version ) {
122+ return String .format (ID_TOOLKIT_ADMIN_URL , version , projectId );
123+ }
124+
116125 @ VisibleForTesting
117126 void setInterceptor (HttpResponseInterceptor interceptor ) {
118127 httpClient .setInterceptor (interceptor );
@@ -304,6 +313,20 @@ void addAuthorizedDomain(String domain) throws FirebaseAuthException {
304313 httpClient .sendRequest (requestInfo , Map .class );
305314 }
306315
316+ void verifyDomain (String domain ) throws FirebaseAuthException {
317+ String url = adminUrl + "/domain:verify" ;
318+ HttpRequestInfo requestInfo = HttpRequestInfo .buildJsonPostRequest (url , Map .of ("domain" , domain , "action" , "VERIFY" ));
319+
320+ httpClient .sendRequest (requestInfo , Map .class );
321+ }
322+
323+ void applyDomain (String domain ) throws FirebaseAuthException {
324+ String url = adminUrl + "/domain:verify" ;
325+ HttpRequestInfo requestInfo = HttpRequestInfo .buildJsonPostRequest (url , Map .of ("domain" , domain , "action" , "APPLY" ));
326+
327+ httpClient .sendRequest (requestInfo , Map .class );
328+ }
329+
307330 ListOidcProviderConfigsResponse listOidcProviderConfigs (int maxResults , String pageToken )
308331 throws FirebaseAuthException {
309332 ImmutableMap .Builder <String , Object > builder =
0 commit comments