Skip to content

Auth list tenants is not pageable #1192

Description

@Klompara
  • Firebase SDK version: 9.8.0
  • Firebase Product: auth

Fetching tenants with firebaseAuth.getTenantManager().listTenants(null) does not return a PageToken even though more pages exist. There is no possibility to page through all tenants.

    private List<Tenant> getAllTenants() {
        ListTenantsPage listTenantsPage = null;
        List<Tenant> allTenants = new ArrayList<>();
        try {
            do {
                listTenantsPage = firebaseAuth.getTenantManager().listTenants(listTenantsPage == null ? null : listTenantsPage.getNextPageToken());
                for (Tenant tenant : listTenantsPage.iterateAll()) {
                    allTenants.add(tenant);
                }
                log.info("Next page token: {}", listTenantsPage.getNextPageToken());
            } while (listTenantsPage.hasNextPage());
        } catch (FirebaseAuthException e) {
            log.error("Could not list tenants", e);
        }
        log.info("Found {} tenants", allTenants.size());
        return allTenants;
    }

When viewing the tenants in the GCP Identity Platform, the same request is used with a page size of 2147483647. However, the admin sdk prevents requesting a page size over 100 (FirebaseTenantClient.MAX_LIST_TENANTS_RESULTS).

Please either remove the page size restriction in the sdk or fix pagination with page token of tenants

Activity

  1. siddharthmohan619-eng commented on Mar 9, 2026

    @siddharthmohan619-eng

    Hello i would love to investigate this and help fix the pagination behavior it is having and has this been triaged yet or is it safe for me to start looking into a PR for this ?

  2. Klompara commented on Mar 9, 2026

    @Klompara
    Author

    @siddharthmohan619-eng I'm not sure if anyone is on it yet, however I think I've already found the error.
    The sdk expects this response: ListTenantsResponse

    However the actual response has this format:

    {
      "tenants": [...],
      "nextPageToken": "..."
    }

    pageToken has to be changed to nextPageToken

  3. siddharthmohan619-eng commented on Mar 9, 2026

    @siddharthmohan619-eng

    @Klompara yes as then it will not return null and when u validate it there will be one more issue u fix it
    k2: "nextPageToken", v2: "PAGE_TOKEN"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions