Is it possible to implement login in an SPA withou...
# talk-kratos
r
Is it possible to implement login in an SPA without ssr? I am currently stuck on submitSelfServiceLoginFlow and I can‘t find any examples how to put it together.
a
It is possible. When you initialize an AJAX browser flow[1], you get a JSON response with
Copy code
...
  "ui": {
    "action": "<https://playground.projects.oryapis.com/self-service/login?flow=ff0c97c4-a7bb-49a5-a8a6-ebf174877fa5>",
    "method": "POST",
    "nodes": [ /* ... */ ]
  },
...
To complete the login, build a
POST
AJAX request with the
action
URL and a request body that follows schema documented here[2]. [1]: https://www.ory.sh/docs/kratos/self-service/flows/user-login#login-for-client-side-ajax-browser-clients [2]: https://www.ory.sh/docs/kratos/reference/api#operation/submitSelfServiceLoginFlow
r
What exactly are you looking at for the schema? I managed to find it in the sdk code after I posted here. But I don't see anything resembling that on the API reference.
a
I was referring to the examples that become visible in the "Request samples" section upon clicking the "example" dropdown
👍 1