Skip to content

customAttributes is not completely preserved when exporting and importing #3319

Closed

Description

@1betatsu

[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}

Activity

  1. thomasmburke commented on Mar 15, 2023

    @thomasmburke
    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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions