kratos icon indicating copy to clipboard operation
kratos copied to clipboard

REST Api document is not expected

Open leapit opened this issue 6 years ago • 3 comments

According REST api

https://www.ory.sh/kratos/docs/reference/api#initialize-browser-based-login-user-flow

Initialize browser-based login user flow

as document,with shell

curl -X GET http://127.0.0.1:4433/self-service/browser/flows/login \
  -H 'Accept: application/json'

got below

<a href="http://127.0.0.1:4455/auth/login?request=198524c3-3b65-4b7c-94e3-f24213f1d8cd">Found</a>.

not as expect a json return.

also,run node example code got error

(node:9377) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at http://127.0.0.1:4455/auth/login?request=dbbed971-67d1-4813-a46a-49f1fcccadca reason: Unexpected token < in JSON at position 0

the document is not up to date?i debug it,found

.then(function(r){
  console.log('---')
  console.log(r.url)
  console.log(r.headers)
  console.log('---')
})

already is json format,r.jsongot wrong

leapit avatar Jul 08 '20 04:07 leapit

Hi there, yeah the documentation for this is autogenerated. The purpose of the endpoint is to be called by a browser, not as application/json - I guess we need to clarify this both in the docs as well in the docs generation.

aeneasr avatar Jul 08 '20 08:07 aeneasr

yeah,i found there is a little difficult for a beginner

leapit avatar Jul 08 '20 09:07 leapit

This is now possible and documented

aeneasr avatar Sep 04 '21 13:09 aeneasr