Closed leapit closed 4 years ago
The first request to http://127.0.0.1:4433/self-service/browser/flows/login
is not supposed to be called using AJAX or fetch. You are supposed to redirect the user to that endpoint, e.g. with <a href="'http://127.0.0.1:4433/self-service/browser/flows/login">Login</a>
.
@aeneasr As i described above,I have many apps,will use kratos verify identity,between my app(node js) and kratos no bowser,how shall I use kratos api from my app to send identifier and password to kratos,and got jwt?
@aeneasr Often,just as @leapit said,we have no server side bowser application,just two parts,one is pure client side,e.g. vue/react/angular,the login designed at client side,the other side is pure server code,e.g. go/node/java,without a pug/hbs login design as kratos-selfservice-ui-node.
There should be an api from pure server code to kratos,otherwise developer have to change a lot about his server side application, at least have to add a template(hbs/pug) for user login.
Sure @leapit @vkiller that API is required and will be added in a future release but we're not there yet. Kratos is still alpha as crucial features like this are missing. For now you can only emulate a browser client, sorry for that. https://www.ory.sh/kratos/docs/self-service/flows/user-login-user-registration/#self-service-user-login-and-user-registration-for-api-clients
@vkiller you can implement Kratos with a SPA today, just don't make an AJAX request to the first endpoint :)
Thanks @aeneasr @zepatrik ,wait for new updates
Use api for login
As follow two documents
https://www.ory.sh/kratos/docs/reference/api#initialize-browser-based-login-user-flow https://www.ory.sh/kratos/docs/reference/api#get-the-request-context-of-browser-based-login-user-flows
I test login,for two steps, 1.init flow,get request id 2.use form post login
code as below(already register the identifier via kratos-selfservice-ui-node),
and got output
Any misstake or misunderstanding?