https://www.ory.sh/ logo
#talk-kratos
Title
# talk-kratos
f

future-ambulance-20226

11/10/2021, 3:58 PM
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

magnificent-energy-493

11/10/2021, 7:29 PM
How are you running Kratos? the http://$kratos_url/ doesn’t look right
f

future-ambulance-20226

11/11/2021, 6:51 AM
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

magnificent-energy-493

11/11/2021, 10:15 AM
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

future-ambulance-20226

11/11/2021, 10:17 AM
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

magnificent-energy-493

11/11/2021, 11:04 AM
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

future-ambulance-20226

11/11/2021, 11:05 AM
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

magnificent-energy-493

11/11/2021, 11:24 AM
Ah yea, you have to supply the whole identity for the settings flow I think
f

future-ambulance-20226

11/11/2021, 11:26 AM
and so if i change the email a new confirmation email is sent?
m

magnificent-energy-493

11/11/2021, 11:28 AM
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

jolly-magazine-7609

11/11/2021, 1:30 PM
do you also need to pass a csrf token?
f

future-ambulance-20226

11/11/2021, 2:33 PM
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

magnificent-energy-493

11/12/2021, 8:41 AM
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

future-ambulance-20226

11/12/2021, 8:47 AM
🙂
7 Views