/logout does not work
call /logout, it return 'bad request 400'
Error: invalid json
at parse (/home/dir/pouch.host/node_modules/body-parser/lib/types/json.js:72:15)
at /home/dir/pouch.host/node_modules/body-parser/lib/read.js:98:18
at IncomingMessage.onEnd (/home/dir/pouch.host/node_modules/body-parser/node_modules/raw-body/index.js:136:7)
at IncomingMessage.g (events.js:175:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
Yup, the issue is browser-request is sending Accept: application/json when the POST request has no body, express json parser is trying to parse the request as json but fails with no body and crashes
We can not use .defaults({json: true}) and only add that to requests that have a body, or patch browser-request or express json body parser, I hadnt dont it yet since I was possibly thinking of replacing browser-request with the ajax library from pouchdb, but that part isnt ready yet
Thank you for your reply. I got easier solution to work around it. Just use opts hash as we did on login, opts.data = {}; that's it. /logout work very well.
I have another questions for you. If you have time, please shed some light on.
- How does this work for Mobile Cordova app? Email verification cannot go to Cordova app.
- When email verification launches different browser than app browser, how could app browser get authentication?
Jing
On Sun, Dec 21, 2014 at 1:16 PM, Dale Harvey [email protected] wrote:
Yup, the issue is browser-request is sending Accept: application/json when the POST request has no body, express json parser is trying to parse the request as json but fails with no body and crashes
We can not use .defaults({json: true}) and only add that to requests that have a body, or patch browser-request or express json body parser, I hadnt dont it yet since I was possibly thinking of replacing browser-request with the ajax library from pouchdb, but that part isnt ready yet
— Reply to this email directly or view it on GitHub https://github.com/pouchdb/pouch.host/issues/45#issuecomment-67778966.
I havent solved those problems yet, it seems like it should be possible to have the email launch the installed application but I havent looked into it
I believe you can use a custom protocol handler in a separate link in the email to load in an app.
Something like: my-pouch-app://{in-app-registration-url}/{token}
The app (afaik) gets that entire string, and can do what it wants with it.
I've not personally done this, so your mileage may vary. :blue_car: