Ale*_*gli 11 firebase firebase-tools firebase-authentication
我想在启动时使用我的测试用户帐户预加载 firebase auth 模拟器,就像我对 Firestore 模拟器及其导入/导出选项所做的一样。我尝试在模拟器运行时使用 auth:import 和 auth:export,但它连接到我们实际的开发 firebase 项目,而不是模拟器。无论如何要针对身份验证模拟器运行 auth:import 和 auth:export 吗?
作为参考,我指的是这些命令 ( https://firebase.google.com/docs/cli/auth ) 和这个模拟器 ( https://firebase.google.com/docs/emulator-suite/connect_auth )。
现在,Firebase 工具中已添加执行此操作的功能
旧的答案仍然有效并且可能有用
https://github.com/firebase/firebase-tools/releases/tag/v9.1.0
支持模拟器:Auth Emulator 的导出和导入 (#2955)。
firebase help auth:import
Usage: firebase auth:import [options] [dataFile]
import users into your Firebase project from a data file(.csv or .json)
Options:
--hash-algo <hashAlgo> specify the hash algorithm used in password for these accounts
--hash-key <hashKey> specify the key used in hash algorithm
--salt-separator <saltSeparator> specify the salt separator which will be appended to salt when verifying password. only used by SCRYPT now.
--rounds <rounds> specify how many rounds for hash calculation.
--mem-cost <memCost> specify the memory cost for firebase scrypt, or cpu/memory cost for standard scrypt
--parallelization <parallelization> specify the parallelization for standard scrypt.
--block-size <blockSize> specify the block size (normally is 8) for standard scrypt.
--dk-len <dkLen> specify derived key length for standard scrypt.
--hash-input-order <hashInputOrder> specify the order of password and salt. Possible values are SALT_FIRST and PASSWORD_FIRST. MD5, SHA1, SHA256, SHA512, HMAC_MD5, HMAC_SHA1, HMAC_SHA256, HMAC_SHA512 support this flag.
-h, --help output usage information
Run Code Online (Sandbox Code Playgroud)
完成此操作的最简单方法是在--export-on-exit运行模拟器时传入 ,例如:firebase emulators:start --export-on-exit .firebase-emulators,这将在退出模拟器时将所有测试数据转储到指定目录中。
然后,如果需要,您可以将其签入源代码(确保模拟器中没有敏感数据),并在firebase emulators:start --import .firebase-emulators每次启动时读取它。
| 归档时间: |
|
| 查看次数: |
1398 次 |
| 最近记录: |