Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/logout does not work #45

Open
jzkunlun opened this issue Dec 21, 2014 · 4 comments
Open

/logout does not work #45

jzkunlun opened this issue Dec 21, 2014 · 4 comments

Comments

@jzkunlun
Copy link

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

@daleharvey
Copy link
Member

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

@jzkunlun
Copy link
Author

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.

  1. How does this work for Mobile Cordova app? Email verification cannot
    go to Cordova app.
  2. 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
#45 (comment).

@daleharvey
Copy link
Member

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

@BigBlueHat
Copy link

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. 🚙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants