FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Fail to migrate user from my existing db

    Scheduled Pinned Locked Moved
    General Discussion
    0
    2
    123
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dominwong4
      last edited by

      Hi FA team,

      I am trying to migrate my users to FusionAuth, but fail to login after I migrate the users.

      From my side,

      Hashing algo should be : salted-hmac-sha256

      From online hmac sha256 generator which is match with my db, so I believe it is in salted-hmac-sha256
      53bd5886-3f69-441d-950e-0a866d55218f-image.png

      the user i try to import:
      email: test@email.com
      password: 12345678 -> hashed: f3c43f0fb6cdf9f91e880b98db7476803f8bb033eb573c098fff5a51f0762e6d
      salt: bBmcgRSa

      then i try to call and API /api/user/import with following request body

      {
          "users": [
              {
                  "email" : "test@email.com",
                  "password" : "f3c43f0fb6cdf9f91e880b98db7476803f8bb033eb573c098fff5a51f0762e6d",
                  "salt":"YkJtY2dSU2E=",
                  "factor":1,
                  "encryptionScheme" : "salted-hmac-sha256"
              }
          ]
      }
      
      

      It return 200OK which is success

      and then I call the API /api/login

      {
          "loginId":"test@email.com",
          "password":"12345678"
      }
      

      it return 404 which means the loginId or password is not matched

      Which step do I get wrong?

      Thanks

      1 Reply Last reply Reply Quote 0
      • M
        maciej.wisniowski Power User
        last edited by

        I'm not sure what is wrong here, maybe try without setting 'factor' at all?
        Anyway, if you have the user's password in plaintext then you can just use these as is and leave encryptionScheme and salt blank. According to docs regarding the password field:

        The User’s password. If encryptionScheme is provided this value is the existing password hash, if encryptionScheme is not provided this value is assumed to be plain text and it will be hashed during import.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post