How to find custom fields exact keys so that they can be used when registering new members from code?

Question:
How to find custom fields exact keys so that they can be used when registering new members from code?

Product:
Velo

What are you trying to achieve:
I’m trying to build a custom registration process, where members/contacts have custom fields that I already added on the site dashboard.

What have you already tried:
My code looks like:

import { authentication } from 'wix-members-frontend';

     $w.onReady(async function () {
        const options = {
            contactInfo: {
                //the keys of customFields are identical to the names of custom fields as I can see them on the site dashboard, under Contacts/Members
                customFields: {"Company": "xyzzy", "Position": "abcd", "First Name": "abcd"}
            },
            privacyStatus: 'PRIVATE'
        };
    
    
    
        return authentication.register(email, password, options)
            .then((registrationResult) => {
                //return registrationResult;
                const status = registrationResult.status;
    
    
                if (status === "PENDING") {
                    console.log('Member registered and waiting for approval:', registrationResult);
                } else {
                    console.log('Member registered and logged in:', registrationResult);
                }
            })
            .catch((error) => {
                console.error(error);
            })
    }

And I always get some error.
The last error I got is:
Unexpected value for field str_value @ @"

Additional information:
All my custom fields have thee type Text, and everything provided in the code through the dictionary customFields is Text too. Some of them were converted to string using JSON.stringify().

Hi! I haven’t tried setting custom fields upon registration, but I do access them quite a bit and they have a very specific syntax. Perhaps this might help you reverse engineer what you need?

Here’s the way to access custom field code (which you might already know):
member.contactDetails.customFields[“custom.yourCustomFieldName”].value

So from that, perhaps you need another “custom” layer before adding your customFields object?

I don’t know - just trying to help with the brainstorm (insert shrug emoji)