firebase / firebase/firebase-tools
`auth:export` fails after 60 minutes with TypeError: Cannot read properties of undefined (reading 'access_token')
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.3k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 84
Description
### [REQUIRED] Environment info
**firebase-tools:** 14.4.0
**Platform:** macOS
### [REQUIRED] Test case
```
firebase auth:export auth.csv --project --debug
```
### [REQUIRED] Steps to reproduce
Run `firebase auth:export auth.csv --project --debug` for a large project with > 10M users.
### [REQUIRED] Expected behavior
The script should succeed with all the accounts exported.
### [REQUIRED] Actual behavior
The command fails after exactly 60 minutes with the following error on the output. There are only about 5M users exported in the CSV.
```
[2025-05-22T08:46:30.588Z] >>> [apiv2][body] POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/downloadAccount {"targetProjectId":"fitify-app","maxResults":1000,"nextPageToken":"HWgDqeyrQdhp9F18qE2ETlcZij72"}
[2025-05-22T08:46:30.730Z] <<< [apiv2][status] POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/downloadAccount 401
[2025-05-22T08:46:30.730Z] <<< [apiv2][body] POST https://www.googleapis.com/identitytoolkit/v3/relyingparty/downloadAccount [omitted]
[2025-05-22T08:46:30.731Z] Got a 401 Unauthenticated error for a call that required authentication. Refreshing tokens.
[2025-05-22T08:46:30.732Z] No OAuth tokens found
[2025-05-22T08:46:30.732Z] No OAuth tokens found
[2025-05-22T08:46:30.732Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2025-05-22T08:46:30.779Z] Running auto auth
[2025-05-22T08:46:30.785Z] TypeError: Cannot read properties of undefined (reading 'access_token')
at getAccessToken (/Users/fitify/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:43:17)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async RetryOperation._fn (/Users/fitify/.cache/firebase/tools/lib/node_modules/firebase-tools/lib/apiv2.js:303:40)
Error: An unexpected error has occurred.
```
Contributor guide
Assessment
This issue has not been assessed yet.