Closed peterkulacs closed 3 days ago
I'm facing the exact same problem on Kratos v1.1.0. Here's my code.
clientConf := client.NewConfiguration()
clientConf.HTTPClient = &http.Client{Timeout: 90 * time.Second}
clientConf.Servers = []client.ServerConfiguration{{URL: KratosEndpoint}}
kratos := client.NewAPIClient(clientConf)
registerFlow, _, err := kratos.FrontendAPI.CreateNativeRegistrationFlow(ctx).Execute()
if err != nil {
return nil, fmt.Errorf("cannot create reigstration flow: %w", err)
}
success, h, err := kratos.FrontendAPI.
UpdateRegistrationFlow(ctx).
UpdateRegistrationFlowBody(client.UpdateRegistrationFlowBody{
UpdateRegistrationFlowWithPasswordMethod: &client.UpdateRegistrationFlowWithPasswordMethod{
Method: "password",
Password: input.Password,
Traits: map[string]interface{}{
"emails": []string{input.Email},
// snip
},
},
}).
Flow(registerFlow.Id).
Execute()
if err != nil {
if h != nil {
respBody, _ := io.ReadAll(h.Body)
fmt.Println("respBody: ", string(respBody))
}
if success != nil {
fmt.Println("result payload: ", *success)
}
return nil, fmt.Errorf("cannot update registration flow: %w", err)
}
// read http response
if h != nil {
body, err := io.ReadAll(h.Body)
if err != nil {
return nil, fmt.Errorf("cannot read response body: %w", err)
}
defer h.Body.Close()
fmt.Println("body: ", string(body))
}
Here's the response body.
{
"session_token": "ory_st_qFoHeGWy7OBmDAkEaVFvKI8pjHXAcVHt",
"session": {
"id": "e20ca114-dacd-469b-855d-2bd160074a5b",
"active": true,
"expires_at": "2024-04-17T10:45:37.638992126Z",
"authenticated_at": "2024-03-18T10:45:37.639001314Z",
"authenticator_assurance_level": "aal1",
"authentication_methods": [
{
"method": "password",
"aal": "aal1",
"completed_at": "2024-03-18T10:45:37.638991746Z"
}
],
"issued_at": "2024-03-18T10:45:37.638992126Z",
"identity": {
"id": "99f99bd6-202b-401c-b18a-4eb3f7c50ae8",
"schema_id": "user_v0",
"schema_url": "https://kratos.digisense.dev/schemas/dXNlcl92MA",
"state": "active",
"state_changed_at": "2024-03-18T10:45:37.633852041Z",
"traits": {
"emails": [
"hzYdwAdmE5@whatever.com"
],
"name_display": "xxxx",
"name_full": "yyyy"
},
"verifiable_addresses": [
{
"id": "1c931d51-3aee-4dc1-b82a-bfbf190f3573",
"value": "hzydwadme5@whatever.com",
"verified": false,
"via": "email",
"status": "sent",
"created_at": "2024-03-18T10:45:37.635577Z",
"updated_at": "2024-03-18T10:45:37.635577Z"
}
],
"recovery_addresses": [
{
"id": "a72e3c37-4a35-43d9-832d-079e20316679",
"value": "hzydwadme5@whatever.com",
"via": "email",
"created_at": "2024-03-18T10:45:37.635959Z",
"updated_at": "2024-03-18T10:45:37.635959Z"
}
],
"metadata_public": null,
"created_at": "2024-03-18T10:45:37.635067Z",
"updated_at": "2024-03-18T10:45:37.635067Z",
"organization_id": null
},
"devices": [
{
"id": "b93710cc-2318-443e-bbb4-58cacbfbdc0c",
"ip_address": "",
"user_agent": "OpenAPI-Generator/1.0.0/go",
"location": ""
}
]
},
"identity": {
"id": "99f99bd6-202b-401c-b18a-4eb3f7c50ae8",
"schema_id": "user",
"schema_url": "https://snip/schemas/dXNlcl92MA",
"state": "active",
"state_changed_at": "2024-03-18T10:45:37.633852041Z",
"traits": {
"emails": [
"hzYdwAdmE5@whatever.com"
],
},
"verifiable_addresses": [
{
"id": "1c931d51-3aee-4dc1-b82a-bfbf190f3573",
"value": "hzydwadme5@whatever.com",
"verified": false,
"via": "email",
"status": "sent",
"created_at": "2024-03-18T10:45:37.635577Z",
"updated_at": "2024-03-18T10:45:37.635577Z"
}
],
"recovery_addresses": [
{
"id": "a72e3c37-4a35-43d9-832d-079e20316679",
"value": "hzydwadme5@whatever.com",
"via": "email",
"created_at": "2024-03-18T10:45:37.635959Z",
"updated_at": "2024-03-18T10:45:37.635959Z"
}
],
"metadata_public": null,
"created_at": "2024-03-18T10:45:37.635067Z",
"updated_at": "2024-03-18T10:45:37.635067Z",
"organization_id": null
},
"continue_with": [
{
"action": "show_verification_ui",
"flow": {
"id": "945106bb-b15c-404a-a7a5-b1394868f09b",
"verifiable_address": "hzydwadme5@whatever.com"
}
},
{
"action": "set_ory_session_token",
"ory_session_token": "ory_st_qFoHeGWy7OBmDAkEaVFvKI8pjHXAcVHt"
}
]
}
Here's the result from my test
result payload: {[] {<nil> <nil> <nil> <nil> {<nil> false} [] <nil> <nil> <nil> <nil> [] map[]} <nil> <nil> map[]}
--- FAIL: TestCreateUser (0.11s)
u_test.go:21: cannot update registration flow: data matches more than one schema in oneOf(ContinueWith)
FAIL
FAIL github.com/snip/client/idp 0.113s
FAIL
This should be resolved with the newest versions of the Ory SDK!
We have released the latest version of the SDK as all the pipeline issues have been fixed. This should be addressed now by upgrading the package :)
Preflight checklist
Ory Network Project
No response
Describe the bug
I'm using the native version of the self service recovery. The Ory client (golang) cannot deserialize the continue_with field.
Reproducing the bug
Set the feature flag in kratos.yml (self hosted) or on the cloud UI.
Trigger the recovery flow
Update the recovery flow with code method
Update (finish) the recovery flow by sending the code
return oc.publicClient.FrontendAPI. UpdateRecoveryFlow(ctx). Flow(flowID). Cookie(cookies). UpdateRecoveryFlowBody(client.UpdateRecoveryFlowWithCodeMethodAsUpdateRecoveryFlowBody(body)). Execute()
Relevant configuration
Version
1.6.1
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
Docker Compose
Additional Context
No response