colinskow / ng-superlogin

AngularJS bindings for the SuperLogin project
MIT License
15 stars 17 forks source link

401 on post to /auth/logout or /auth/refresh #3

Open baststar opened 8 years ago

baststar commented 8 years ago

In the request of refresh or logoutOthers for example there is no "ETag" but WWW-Authenticate:Bearer realm="Users" validateUsername works.

Also, if i activate require_valid_user in couchdb, i get the www-authentication-popup within my ionic-app on the device.

colinskow commented 8 years ago

A 401 unauthorized means that the session token is invalid. The session has already been logged out. It could also mean that for some reason the $http interceptor isn't correctly sending the Authorization header because your endpoints aren't configured correctly. See the bottom of https://github.com/colinskow/ng-superlogin/issues/2 for more information.

baststar commented 8 years ago

Okay, forgot the port ip:3000 on the endpoint! now that works! many thanks :-) Any suggestions about the www-authentication popup. it still pops up. "http://ip:5984 requires a username and password" after successfully login with couchdb-configuration "require_valid_user" = true (cors is enabled)

its directly after login... and repopup after some timeout. but it ends after navigation (statechange) maybe it disappears after checkExpired... hmm

on the device it still pops up every x seconds...

the www-authentication is from a http://ip:5984/dbname/_bulk_get?revs=true&attachments=true&_nonce=1450190595020 - request without basic-auth... its a shared-db

i think its an to early access to the database... i will test it

colinskow commented 8 years ago

The popup seems to indicate that you are not sending a valid username and password to the CouchDB database. NG-SuperLogin doesn't do this automatically for you. You need to manually specify the username and password.

See line 114 here for help.

baststar commented 8 years ago

Do you mean that part?

$rootScope.$on('sl:login', function() { // Make sure data from previous user is erased destroySequence() .then(function() { startSequence(); }); });

i do this, but i still get the www-auth-popup

baststar commented 8 years ago

It seems to work with pouchdb version 4.0.0, i used 5.1.0 Yes, all fine on device with ionic and in browser (chrome) with pouchdb 4.0.0

colinskow commented 8 years ago

If you can isolate the issue with PouchDB, please do file an issue with them.

baststar commented 8 years ago

i think it has to do with that: http://pouchdb.com/2015/10/06/pouchdb-5.0.0-five-years-of-pouchdb.html "The biggest news in terms of features is support for _bulk_get, which is a new CouchDB API that enables vastly faster replication, set to be debuted in CouchDB 2.0. This API is also shipped in the newly-released PouchDB Server 1.0.0, meaning you can test out the faster replication now."