Hello, while I am using HTTP API for update a prof...
# talk-kratos
f
Hello, while I am using HTTP API for update a profile I get: Error: socket hang up The request is POST http://$kratos_url/self-service/settings?flow=$flow_id Request Headers X-Session-Token: $session_token Content-Type: application/json { “method”: “profile”, “traits”: { … } }
m
How are you running Kratos? the http://$kratos_url/ doesn’t look right
f
is just a placeholder but is localhost and kratos port all the remaining requests work properly
moreover if i remove the flow parameter it correctly say me that it miss
whenever instead I type the flow parameter it works as I wrote
another strange behaviour is the follow: the password method works properly, the problem arise only with profile one
m
I type the flow parameter it works as I wrote
you mean it doesn’t work?
try this: run the flow with the chrome developer console in an incognito window and check every single request to / from kratos
f
http://localhost:3000/self-service/settings if i try to perform this request it correctly says that flow is missing http://localhost:3000/self-service/settings?flow=value it says: 1. in the case of method profile: socket hang up 2. in the case of method password: a. it works if the password is valid (respect minimum char etc) b. again socket hangup if the password is not valid (here i expected an error)
message has been deleted
message has been deleted
message has been deleted
@magnificent-energy-493 you can see also from the screenshot what i wrote above
m
Thanks Guiseppe! Can you try out the flow without Postman (e.g. using curl). Since Postman is a browser itself, it can cause problems. Are you looking at an API-initiated flow or a browser-initiated flow?
f
api one
Ok @magnificent-energy-493 i tried with curl :
Copy code
curl --location --request POST '<http://127.0.0.1:49275/self-service/settings?flow=e4fd7b62-7124-42b2-b2cf-db987529b267>' \
--header 'X-Session-Token: e2WaGkpH6ClbrerJCimweF2XYBVjrn28' \
--header 'Content-Type: application/json' \
--data-raw '{"method":"profile", "traits": {"birth_date":  "2021-10-11"}}'
the response is curl: (52) Empty reply from server
ow, maybe i got the point I see an error in the kratos console ncountered self-service settings error. audience=audit error=map[message:I[#/traits] S[#/properties/traits/$ref] doesn’t validate with “file://etc/config/kratos/user.schema.json#/properties/traits [#/properties/traits/required] missing properties: “email”, “name”, “username”]
m
Ah yea, you have to supply the whole identity for the settings flow I think
f
and so if i change the email a new confirmation email is sent?
m
Not sure about that, I would have to check how it works. But a new mail should be sent to confirm the new email.
You might have to start a new verification flow.
j
do you also need to pass a csrf token?
f
no @jolly-magazine-7609
I am using api flow, in broswer one for sure you need to pass also the csrf
Just in case someone is interested in whenever you change the email kratos detect you did it and send a verification email
m
Thanks for reporting this back @future-ambulance-20226! I will add it to the next FAQ overhaul (coming up soon)
I thought it would work this way, but always good to doublecheck 😉
f
🙂