firebase-tools: `firebase auth:export` doesn't include provider info for Apple Sign In
[REQUIRED] Environment info
firebase-tools: 9.11.0
Platform: macOS (M1)
[REQUIRED] Test case
I can’t provide a test case, because I would need to give you access to my Firebase project.
[REQUIRED] Steps to reproduce
- Set up a Firebase project
- Enable “Apple Sign In” for Firebase Auth
- Use Sign In with Apple with a user
- Run
firebase auth:export auth_export.json - Open
auth_export.json
[REQUIRED] Expected behavior
I would expect that the provider info also be export like:
{
"localId": "0YPO0atCUVaeP8gTIZVDn4oZxIZ2",
"email": "myaccount@icloud.com",
"emailVerified": true,
"lastSignedInAt": "1621582693401",
"createdAt": "1621582693401",
"providerUserInfo": [
{
"providerId": "apple.com",
"rawId": "rawId",
"email": "myaccount@icloud.com",
"displayName": "MyName",
}
]
},
If you import this data, the user should have an Apple provider:

[REQUIRED] Actual behavior
{
"localId": "0YPO0atCUVaeP8gTIZVDn4oZxIZ2",
"email": "myaccount@icloud.com",
"emailVerified": true,
"lastSignedInAt": "1621582693401",
"createdAt": "1621582693401",
"providerUserInfo": [] // <----- Why is this empty???
},
If you import this data, the use will not have a provider:

About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 10
- Comments: 19 (3 by maintainers)
Made some progress on this locally. Cloned
firebase-toolsand made the following changes:src/accountExporter, add"apple.com": 23to thePROVIDER_ID_INDEX_MAP(I think you can just assign any number in increments of 4)src/accountImporter, add"apple.com"toALLOWED_PROVIDER_IDSsrc/accountImporter, add_addProviderUserInfo(user, "apple.com", arr.slice(23, 27));below the other_addProviderUserInfocalls (lines up with the ID index map fromaccountExporter)It exports the
providerUserInfocorrectly i.e.This caused a suppressed
localId is missingerror on import, so I had to swap outconst user = validateUserJson(value);forconst user = valueinauth-import.ts. If you took some time, you could probably figure out why thevalidateUserJsonfunction was returning{}instead of the user data.Anyway, successfully imported all my apple-auth’ed users.
Hi, thanks for filing this issue! We are unable to promise any timeline for this, but if others also have this issue, adding a thumbs up on this issue can help us prioritize adding this to the roadmap.
(Googler-only internal tracking bug: b/240348641)
Hi @lisajian, it’s great to see that this issue got some attention ❤️ However, it’s for me unclear why the Firebase hasn’t fixed this issue after 2 year (after adding Apple as new sign in provider). Exporting the Firebase Auth user is essential for every production app. How should you do your backups without exporting all users? Issues like this should be a red flag for every company for using Firebase in production because good backups are necessary for production apps.
Totally understand your concern and we’re working on triaging the issue internally. While this is getting addressed, please take a look at the other ways of exporting and importing users, e.g. Admin SDK’s
listUsers()for exporting andcreateUser()for importing, or you can hit the underlying endpoints directly by callingbatchGetfor exporting andbatchCreatefor importing. These will return up to date user info, including Apple as a sign in provider.