Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customAttributes is not completely preserved when exporting and importing #3319

Closed
1betatsu opened this issue Apr 28, 2021 · 1 comment · Fixed by #5630
Closed

customAttributes is not completely preserved when exporting and importing #3319

1betatsu opened this issue Apr 28, 2021 · 1 comment · Fixed by #5630

Comments

@1betatsu
Copy link

[REQUIRED] Environment info

firebase-tools:
9.10.0

Platform:
macOS

[REQUIRED] Test case

Set custom claim {"admin":true} by any SDK or something.
Export accounts from firebase by firebase auth:export, and import the exported file by firebase auth:import.
Export accounts again, then you will find the customAttributes miss double quotations like {admin:true}.

[REQUIRED] Steps to reproduce

Set Custom Claims by Go SDK

// Set admin privilege on the user corresponding to uid.
claims := map[string]interface{}{"admin": true}
err = client.SetCustomUserClaims(ctx, uid, claims)
if err != nil {
	log.Fatalf("error setting custom claims %v\n", err)
}

Export accounts

firebase auth:export ACCOUNT_FILE

Import the exported file.

firebase auth:import ACCOUNT_FILE \
    --hash-algo=YOURS \
    --hash-key=YOURS \
    --salt-separator=YOURS \
    --rounds=YOURS \
    --mem-cost=YOURS

[REQUIRED] Expected behavior

Custom claims are preserved as {"admin":true}

[REQUIRED] Actual behavior

Double quotations were disappeared as {admin:true}

@thomasmburke
Copy link
Contributor

Just tested this and it appears this behavior is specific to the CSV export, so if you are looking to preserve custom claims for users upon import and export via firebase-tools the JSON file type is a valid workaround as the team looks to fix buggy behavior highlighted here pertaining to CSV file types.

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

Successfully merging a pull request may close this issue.

3 participants