Hey everyone! I'm trying to integrate the login f...
# talk-kratos
q
Hey everyone! I'm trying to integrate the login flow with an Unreal Engine client. When submitting the login data, I'd get a "Could not find a strategy to log you in with" response from the server, like this one:
Copy code
{
  "id": "1cf5ace9-d7f2-4f1f-8def-8bd5064f9d48",
  "oauth2_login_challenge": null,
  "type": "api",
  "expires_at": "2023-04-09T19:13:47.964343Z",
  "issued_at": "2023-04-09T19:03:47.964343Z",
  "request_url": "https://{redacted-host}/self-service/login/api",
  "ui": {
    "action": "https://{redacted-host}/self-service/login?flow=1cf5ace9-d7f2-4f1f-8def-8bd5064f9d48",
    "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": {}
          }
        }
      }
    ],
    "messages": [
      {
        "id": 4010002,
        "text": "Could not find a strategy to log you in with. Did you fill out the form correctly?",
        "type": "error"
      }
    ]
  },
  "created_at": "2023-04-09T19:03:47.972962Z",
  "updated_at": "2023-04-09T19:03:47.972962Z",
  "refresh": false,
  "requested_aal": "aal1"
}
These are corresponding the payload ...
Copy code
URL: https://{redacted-host}/self-service/login?flow=1cf5ace9-d7f2-4f1f-8def-8bd5064f9d48
{
    "csrf_token": "",
    "identifier": "{redacted-email-address}",
    "method": "password",
    "password": "{redacted-password}"
}
... and the login flow creation:
Copy code
{
  "id": "1cf5ace9-d7f2-4f1f-8def-8bd5064f9d48",
  "oauth2_login_challenge": null,
  "type": "api",
  "expires_at": "2023-04-09T19:13:47.964343737Z",
  "issued_at": "2023-04-09T19:03:47.964343737Z",
  "request_url": "https://{redacted-host}/self-service/login/api",
  "ui": {
    "action": "https://{redacted-host}/self-service/login?flow=1cf5ace9-d7f2-4f1f-8def-8bd5064f9d48",
    "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": "2023-04-09T19:03:47.972962Z",
  "updated_at": "2023-04-09T19:03:47.972962Z",
  "refresh": false,
  "requested_aal": "aal1"
}
The same login flow & payload works when used via an HTTP tool (Insomnia), though. Any hints on what the reason could be are very appreciated. Best regards
b
I think it expects the body to be urlencoded, not json (though perhaps adding a content-type header can let it be json)
q
Hey Gregory! Yep, you're right. Apparently Unreal sets
Copy code
application/x-www-form-urlencoded
as the default Content-type. When I explicitly set it in Insomnia, I get the same error message - and setting it to application/json fixes it in the client.. TYVM 😊 I think the error message is still somewhat confusing