CORS error while importing Users
-
Scenario while importing Users from JSON file - after resolving the CORS, getting a response as show below. Would like to know what configuration is suitable for FusionAuth CORS to allow User import to work?
Also, check the below images for further reference -
callApiWithJsonData(...) -> Where actual call is happening ...
convertFirebaseToFusion --> Reference for User Data structure -
Error shown in console is as below -
Unknown scheme, whereas, I want to save the password as default password. There is no reason to ask for Scheme.
-
Hi @sandesh,
Thanks for using FusionAuth.
It is more typical to import users from a server side process, but there's no API restriction that prevents it.
It seems like if you omit an
encryptionScheme
on the user object, FusionAuth will treat the password as plaintext. From the docs:users[x].encryptionScheme [String] Optional defaults to salted-pbkdf2-hmac-sha256
The method for encrypting the User’s password. If the password value is already encrypted this value is required.
Omitting this value indicates the password is in plain text and it will be encrypted using the default password encryptor.Can you share a bit of your import JSON (one or two users)?
-
@dan I agree Dan, I saw documentation and decided not to use the scheme and encrypt using default method of Fusionauth. I even tried after removing salt parameter and setting the default password as - 123123. Still facing the same issue. Here are couple of Users which I am trying to migrate -
{"users": [
{
"localId": "14fP6HjVVEMmBphn3gJSF7WPjrY2",
"email": "g.vikas@pm.me",
"emailVerified": true,
"passwordHash": "8VCNbPGEelyjrDM/G51O97rOiQ2/4rTlFMiFy6Wxnw/gUbfBz3No93/stcbunU3/XM+RbCQYq2t7deVXHw8RzQ==",
"salt": "3mES5SUwakkouw==",
"displayName": "vikas asadf",
"lastSignedInAt": "1672216572913",
"createdAt": "1664788494325",
"providerUserInfo": []
},
{
"localId": "b9YMS5fqNeXX2dCcAnxSl1yFAyG3",
"email": "sandesh@pm.com",
"emailVerified": true,
"passwordHash": "DkeD4bCS0awG42rhNty1RfAsQb5DUdVhYo2LNmKgVFGj2bqPKOGTdnRZwigOarslNIM6/0EcAlTpKvc+3o+5bA==",
"salt": "0yCVEp3/yykh/Q==",
"displayName": "Sandesh asdad",
"lastSignedInAt": "1684406569761",
"createdAt": "1671419702169",
"providerUserInfo": []
}
]} -
@sandesh
passwordHash
is not a valid parameter, neither isproviderUserInfo
,emailVerified
orlocalId
, so this would never work. Please consult the import API documentation to check to see you are creating the JSON correctly: https://fusionauth.io/docs/v1/tech/apis/users#request-7If you are providing the password in a hash, you need to provide the
encryptionScheme
and the hash value in thepassword
field.If you are not providing the hashed password, omit the
encryptionScheme
and provide a plaintext value in thepassword
field, such as123123
, as you suggest. -
Hey @dan , I shared you the pre-processed data, which is incorrect information. Please check the processed data that is used to import the Users.
{
"users":[{
"email":"schneider.jochen@pm.me",
"active":true,
"fullname":"JOchen asadf",
"passwordChangeRequired":true,
"verified":true,
"password":"123123"
},
{
"email":"jochen.odsport@gmail.com",
"active":true,
"fullname":"Jochen fdshgsdhf",
"passwordChangeRequired":true,
"verified":false,
"password":"123123"
}
]} -
@dan I tried using javascript when tried using POSTMAN, it is working fine. We can close this ticket.
-
-
@sandesh Great, glad you figured it out!