hello <@498057949541826571> I am currently implementing the custom UI flow with additional formField...
k
hello @rp_st I am currently implementing the custom UI flow with additional formFields in the form but somehow I am getting this error
Copy code
{message: "Are you sending too many / too few formFields?"}
here is the setting on the backend
Copy code
EmailPassword.init({
      signUpFeature: {
        formFields: [
          {
            id: 'name'
          },
          {
            id: 'phone',
            optional: true
          },
          {
            id: 'userId',
            optional: true
          }
        ]
      }
from the frontend I am calling it like this
Copy code
const formFields = Object.keys(payload).map(item => ({id: item, value: payload[item]})) 
    
    try {
        let response = await signUp({
            formFields
        })
do I need to setup the same thing on frontend as well when initialising supertokens?
r
hey @khanprog
whats the request body that you are sending?
k
Copy code
[
    {
        "id": "name",
        "value": "My Pug"
    },
    {
        "id": "email",
        "value": "test@test.com"
    },
    {
        "id": "password",
        "value": "testing1234"
    },
    {
        "id": "userId",
        "value": "lakdsjf12j3l1k2j3"
    }
]
r
you also need to give
phone
. You can give it as an empty string if you don't haev the value. I know that it is marked as optional, but that just means that it can be an empty string. I know that this is not intuitive - it's an open issue
but for now, just make sure you pass all the fields, and for the optional one, you can make the value an empty string
k
Alright let me try that
Great that worked
thanks for the input. I think it will be better if there is something in the docs as a notice or caution in docs
r
yeaa for sure. We plan on fixigin this anyway, so that optional actually means optional and not empty string
k
great
4 Views