# User import from SAP Commerce (pbkdf2-sha1), login fails

**URL:** <https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259>\
**Category:** Get Help\
**Tags:** password, user-import\
**Created:** [May 24, 2021, 10:13am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259 "2021-05-24T10:13:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![teemu.alander](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/teemu.alander/32/12714_2.png) [@teemu.alander](https://community.auth0.com/u/teemu.alander)\
**Post date:** [May 24, 2021, 10:13am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/1 "2021-05-24T10:13:22Z")

</div>

I am exporting users from SAP commerce which have pbkdf2 encoded passwords (sha1) with 1000 iterations and 512 length. Import is fine and works but for some reason I cannot login with my imported user. I followed this instruction [Bulk User Import Database Schema and Examples](https://auth0.com/docs/users/bulk-user-import-database-schema-and-examples) and used User Import / Export Extension.

What could be wrong? Has someone else tried SAP Commerce / Hybris user import? The SAP commerce encodes passwords with PBKDF2WithHmacSHA1 I think.

Here is on import example that I tried:  
[  
{  
“user\_id”: “[myexample@example.com](mailto:myexample@example.com)”,  
“name”: “Example”,  
“given\_name”: “Example”,  
“custom\_password\_hash”: {  
“algorithm”: “pbkdf2”,  
“hash”: {  
“value”: “$pbkdf2-sha1$i=1000,l=512$33a4b650b42fd660a192706dbe91c505$0d9cd09395a9470ced62c1e9395fb31b50e229ba3b93d911737b672891795f5479a3eff0e1926979efb50eb6a48bc69f7853e2ca965adc76dc68b4635bd5689f”  
}  
},  
“email”: “[myexample@example.com](mailto:myexample@example.com)”,  
“email\_verified”: true  
}  
]

---

<div class="post-metadata">

**Author:** ![thameera](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/thameera/32/13430_2.png) [@thameera](https://community.auth0.com/u/thameera)\
**Post date:** [May 28, 2021, 8:01am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/2 "2021-05-28T08:01:40Z")

</div>

Hey @teemu.alander , one issue here is that the salt and hash values seem to be hex-ecnoded, whereas Auth0 requires them to be in base64 encoding (which is the standard): [Bulk User Import Database Schema and Examples](https://auth0.com/docs/users/bulk-user-import-database-schema-and-examples#pbkdf2)  
You can use a script to convert the two values to base64, embed them in the PHC string, and try importing again.

If that doesn’t work, we can take a look if you can post a password hash for a known plain text value (eg: `hello`). Don’t paste the hash of an actual password.

---

<div class="post-metadata">

**Author:** ![teemu.alander](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/teemu.alander/32/12714_2.png) [@teemu.alander](https://community.auth0.com/u/teemu.alander)\
**Post date:** [June 1, 2021, 8:38pm UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/3 "2021-06-01T20:38:01Z")

</div>

I manageed to convert hex to base64. And now it looks like:

```
[

```

{  
“user\_id”: “[myexample@example.com](mailto:myexample@example.com)””,  
“name”: “Example”,  
“given\_name”: “Example”,  
“custom\_password\_hash”: {  
“algorithm”: “pbkdf2”,  
“hash”: {  
“value”: “$pbkdf2-sha1$i=1000,l=512$idlJ8SjQJr4hg9FDpKeyKA==$6ZZ+oZ26X5GNPq6xQ6wnchMzXpLFAmBQ32m56p105lZV7syujaAK2RmFQur6jsmEo8KkvOIJGbWQ7CeWmSIBoA==”  
}  
},  
“email”: "[myexample@example.com](mailto:myexample@example.com)”  
}  
]

But the problem in import is:

```
    "errors": [
        {
            "code": "ONE_OF_MISSING",
            "message": "",
            "path": "custom_password_hash"
        }
    ]

```

So I guess the “=” is not according to PHC? But how do I change the new Base64 encoded string “6ZZ+oZ26X5GNPq6xQ6wnchMzXpLFAmBQ32m56p105lZV7syujaAK2RmFQur6jsmEo8KkvOIJGbWQ7CeWmSIBoA==” to correct one without “==”? Can I just remove the “==”? I guess not?

---

<div class="post-metadata">

**Author:** ![teemu.alander](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/teemu.alander/32/12714_2.png) [@teemu.alander](https://community.auth0.com/u/teemu.alander)\
**Post date:** [June 2, 2021, 7:55am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/5 "2021-06-02T07:55:00Z")

</div>

Got this working. What I needed to do was:

- Ensure salt + password was base64 encoding without padding (in java: Base64.getEncoder().withoutPadding().encodeToString(decodedHexSalt)😉
- Ensure that my keylen was in BYTES (instead of bits)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [June 2, 2021, 8:47am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/6 "2021-06-02T08:47:29Z")

</div>

Perfect! Glad you have figured it out and thanks for sharing with the rest of community!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 17, 2021, 8:48am UTC](https://community.auth0.com/t/user-import-from-sap-commerce-pbkdf2-sha1-login-fails/63259/7 "2021-06-17T08:48:19Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
