Closed
Description
Preflight checklist
- I could not find a solution in the existing issues, docs, nor discussions.
- I agree to follow this project's Code of Conduct.
- I have read and am following this repository's Contribution Guidelines.
- I have joined the Ory Community Slack.
- I am signed up to the Ory Security Patch Newsletter.
Ory Network Project
No response
Describe the bug
The Kratos Go client (version 1.1.0) fails to correctly unmarshal the JSON response into the LoginFlow object.
This happens because it defines the state field as a required property, which is not provided within the response from the Kratos instance (version 1.1.0)
An easy fix for it would be to remove the state field as a required property, like on this fork.
Reproducing the bug
When initiating a native login flow using something like:
kratosClient := client.NewAPIClient(configuration)
loginFlow, _, err := kratosClient.FrontendAPI.CreateNativeLoginFlow(context.Background()).Execute()
if err != nil {
fmt.Println(err)
}
the error occurs.
Inspecting the response using curl to initiate the flow:
curl -X GET \
-H 'Content-Type: application-json' \
127.0.0.1:4433/self-service/login/api
shows that there is no state field being returned at this stage of the flow:
{
"id": "b63875be-64ea-48d5-84a6-ad2a04793687",
"type": "api",
"expires_at": "2024-03-28T22:26:36.416713342Z",
"issued_at": "2024-03-28T22:16:36.416713342Z",
"request_url": "http://127.0.0.1:4433/self-service/login/api",
"ui": {
"action": "http://kratos:4433/self-service/login?flow=b63875be-64ea-48d5-84a6-ad2a04793687",
"method": "POST",
"nodes": [
{
"type": "input",
"group": "default",
"attributes": {
"name": "csrf_token",
"type": "hidden",
"value": "",
"required": true,
"disabled": false,
"node_type": "input"
},
"messages": [],
"meta": {}
},
{
"type": "input",
"group": "default",
"attributes": {
"name": "identifier",
"type": "text",
"value": "",
"required": true,
"disabled": false,
"node_type": "input"
},
"messages": [],
"meta": {
"label": {
"id": 1070004,
"text": "ID",
"type": "info"
}
}
},
{
"type": "input",
"group": "password",
"attributes": {
"name": "password",
"type": "password",
"required": true,
"autocomplete": "current-password",
"disabled": false,
"node_type": "input"
},
"messages": [],
"meta": {
"label": {
"id": 1070001,
"text": "Password",
"type": "info"
}
}
},
{
"type": "input",
"group": "password",
"attributes": {
"name": "method",
"type": "submit",
"value": "password",
"disabled": false,
"node_type": "input"
},
"messages": [],
"meta": {
"label": {
"id": 1010001,
"text": "Sign in",
"type": "info",
"context": {}
}
}
}
]
},
"created_at": "2024-03-28T22:16:36.446211Z",
"updated_at": "2024-03-28T22:16:36.446211Z",
"refresh": false,
"requested_aal": "aal1"
}
Relevant log output
2024/03/28 20:21:00 stdout: no value given for required property state
Relevant configuration
No response
Version
1.1.0
On which operating system are you observing this issue?
macOS
In which environment are you deploying?
Docker Compose
Additional Context
No response