Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .github/resources/integ-service-account.json.gpg
Binary file not shown.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: ${{ matrix.go }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:

steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: ${{ github.event.client_payload.ref || github.ref }}

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.23'

Expand All @@ -53,7 +53,7 @@ jobs:

- name: Send email on failure
if: failure()
uses: firebase/firebase-admin-node/.github/actions/send-email@master
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
with:
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
Expand All @@ -68,7 +68,7 @@ jobs:

- name: Send email on cancelled
if: cancelled()
uses: firebase/firebase-admin-node/.github/actions/send-email@master
uses: firebase/firebase-admin-node/.github/actions/send-email@2e2b36a84ba28679bcb7aecdacabfec0bded2d48 # Admin Node SDK v13.6.0
with:
api-key: ${{ secrets.OSS_BOT_MAILGUN_KEY }}
domain: ${{ secrets.OSS_BOT_MAILGUN_DOMAIN }}
Expand Down
59 changes: 16 additions & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ jobs:

runs-on: ubuntu-latest

# When manually triggering the build, the requester can specify a target branch or a tag
# via the 'ref' client parameter.
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref || github.ref }}
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Set up Go
uses: actions/setup-go@v5
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.23'

Expand All @@ -71,57 +67,34 @@ jobs:
# 3. with the label 'release:publish', and
# 4. the title prefix '[chore] Release '.
if: github.event.pull_request.merged &&
github.ref == 'refs/heads/dev' &&
github.base_ref == 'dev' &&
contains(github.event.pull_request.labels.*.name, 'release:publish') &&
startsWith(github.event.pull_request.title, '[chore] Release ')

runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout source for publish
uses: actions/checkout@v4
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: dev
persist-credentials: false

- name: Publish preflight check
id: preflight
run: ./.github/scripts/publish_preflight_check.sh

# We authorize this step with an access token that has write access to the master branch.
- name: Merge to master
uses: actions/github-script@v7
with:
github-token: ${{ secrets.FIREBASE_GITHUB_TOKEN }}
script: |
github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: 'master',
head: 'dev'
})

# See: https://cli.github.com/manual/gh_release_create
- name: Create release tag
# Create a PR to merge dev into master.
- name: Create Release PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ steps.preflight.outputs.version }}
--title "Firebase Admin Go SDK ${{ steps.preflight.outputs.version }}"
--notes '${{ steps.preflight.outputs.changelog }}'
--target "master"

# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
- name: Post to Twitter
if: success() &&
contains(github.event.pull_request.labels.*.name, 'release:tweet')
uses: firebase/firebase-admin-node/.github/actions/send-tweet@master
with:
status: >
${{ steps.preflight.outputs.version }} of @Firebase Admin Go SDK is available.
https://github.com/firebase/firebase-admin-go/releases/tag/${{ steps.preflight.outputs.version }}
consumer-key: ${{ secrets.FIREBASE_TWITTER_CONSUMER_KEY }}
consumer-secret: ${{ secrets.FIREBASE_TWITTER_CONSUMER_SECRET }}
access-token: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.FIREBASE_TWITTER_ACCESS_TOKEN_SECRET }}
continue-on-error: true
RELEASE_BODY: ${{ steps.preflight.outputs.changelog }}
RELEASE_TITLE: "[chore] Release ${{ steps.preflight.outputs.version }}"
run: |
gh pr create \
--base master \
--head dev \
--title "$RELEASE_TITLE" \
--body "$RELEASE_BODY"
49 changes: 49 additions & 0 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Tag Release

on:
push:
branches:
- master
paths:
- 'firebase.go'

jobs:
tag_release:
if: startsWith(github.event.head_commit.message, '[chore] Release ')

runs-on: ubuntu-latest
environment: Release
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1

- name: Publish preflight check
id: preflight
run: ./.github/scripts/publish_preflight_check.sh

- name: Create release tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VER: ${{ steps.preflight.outputs.version }}
RELEASE_NOTES: ${{ steps.preflight.outputs.changelog }}
run: gh release create "$RELEASE_VER" \
--title "Firebase Admin Go SDK $RELEASE_VER" \
--notes "$RELEASE_NOTES" \
--target "master"
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ The Firebase Admin Go SDK enables server-side (backend) applications to interact

- **DO:** Use the centralized HTTP client in `internal/http_client.go` for all network calls.
- **DO:** Pass `context.Context` as the first argument to all functions that perform I/O or other blocking operations.
- **DO:** Run `go fmt` after implementing a change and fix any linting errors.
- **DON'T:** Expose types or functions from the `internal/` directory in the public API.
- **DON'T:** Introduce new third-party dependencies without a strong, documented justification and team consensus.

Expand Down
8 changes: 6 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,12 @@ Set up your Firebase project as follows:

2. Enable Firestore:
1. Go to the Firebase Console, and select **Firestore Database** from the **Build** menu.
2. Click on the **Create database** button. You can choose to set up Firestore either in
the production mode or in the test mode.
2. Click on the **Create database** button and create a default database. You can choose
to set up Firestore either in the production mode or in the test mode.
> **Note:** Integration tests are run against both the default database and an additional
database named "testing-database".
3. After the default database is created, click the **Add database** button to create a
second database named "testing-database".


3. Enable Realtime Database:
Expand Down
29 changes: 29 additions & 0 deletions auth/tenant_mgt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,35 @@ func TestTenantGetUser(t *testing.T) {
}
}

func TestTenantQueryUsers(t *testing.T) {
resp := `{
"usersInfo": [],
"recordsCount": "0"
}`
s := echoServer([]byte(resp), t)
defer s.Close()

tenantClient, err := s.Client.TenantManager.AuthForTenant("test-tenant")
if err != nil {
t.Fatalf("Failed to create tenant client: %v", err)
}

returnUserInfo := true
query := &QueryUsersRequest{
ReturnUserInfo: &returnUserInfo,
}

_, err = tenantClient.QueryUsers(context.Background(), query)
if err != nil {
t.Fatalf("QueryUsers() with tenant client = %v", err)
}

wantPath := "/projects/mock-project-id/tenants/test-tenant/accounts:query"
if s.Req[0].RequestURI != wantPath {
t.Errorf("QueryUsers() URL = %q; want = %q", s.Req[0].RequestURI, wantPath)
}
}

func TestTenantGetUserByEmail(t *testing.T) {
s := echoServer(testGetUserResponse, t)
defer s.Close()
Expand Down
Loading