[英]Import users into Firebase with password encrypted with MD5CryptoServiceProvider
我正在嘗試使用 MD5CryptoServiceProvider 加密的密碼將我現有的用戶數據庫導入MD5CryptoServiceProvider
。 我似乎無法使其正常工作,至少在 C# 中的 Firebase Admin SDK 中。
它給我的錯誤是不能將 system.Security.Cryptography.md5cryptoserviceprovider 隱式轉換為 firebase_admin.auth.user import hash
這是我的代碼:
try
{
string password = "hashed_password";
var users = new List<ImportUserRecordArgs>()
{
new ImportUserRecordArgs()
{
Uid = "some-uid",
Email = "user@example.com",
PasswordHash = Encoding.ASCII.GetBytes(password),
PasswordSalt = null,
},
};
var options = new UserImportOptions()
{
Hash = new MD5CryptoServiceProvider()
{
//Key = md5.ComputeHash(Encoding.ASCII.GetBytes(text))
},
};
UserImportResult result = await FirebaseAuth.DefaultInstance.ImportUsersAsync(users, options);
foreach (ErrorInfo indexedError in result.Errors)
{
Console.WriteLine($"Failed to import user: {indexedError.Reason}");
}
}
catch (FirebaseAuthException e)
{
Console.WriteLine($"Error importing users: {e.Message}");
}
我的問題是,我應該如何配置UserImportedOptions
以便它工作......
我為此使用 C#。
明白了,只是使用的問題
var options = new UserImportOptions()
{
Hash = new Md5
{
Rounds = 0
},
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.