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

Username response ? #84

Closed
ghost opened this Issue Feb 28, 2016 · 4 comments

Comments

Projects
None yet
1 participant
@ghost
Copy link

ghost commented Feb 28, 2016

I just get the id and token as response on authenticate using postegres
If I try to app.logout() I also get a TypeError: storage.remove is not a function

import io from 'socket.io-client';
import feathers from 'feathers/client';
import hooks from 'feathers-hooks';
import socketio from 'feathers-socketio/client';
import storage from 'feathers-memory';
import localstorage from 'feathers-localstorage';
import authentication from 'feathers-authentication/client';

const socket = io('localhost:3030');
const api = feathers()
  .configure(socketio(socket)) // you could use Primus or REST instead
  .configure(hooks())
  .use('storage', localstorage())
  .configure(authentication());

  api.io.on('connect', function(){
      console.log("connection....");
      api.authenticate({
        type: 'local',
        'email': 'user@email.com',
        'password': '1234'
      }).then(function(result){
          console.log(result);
      }).catch(function(error){
        console.error('Error authenticating!', error);
      });
  });


  api.io.on("authenticated", function(result){

    console.log("user is :");
    api.user().then(function(user){
      console.log(user);
    })

  });

  api.io.connect();

I've also tried with .configure(authentication({ idField: 'id' }));

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 28, 2016

@naptiv Two questions:

  • which version for feathers-authentication are you using? We had pushed an update yesterday morning that fixed the response on auth to include the user.
  • Where are you using the client? The browser?
@ghost

This comment has been minimized.

Copy link
Author

ghost commented Feb 28, 2016

  • feathers-authentication@0.4.0
  • yep browser.

Btw, I had to change .use('storage', localstorage({"storage":memory})) as I got a ReferenceError: window is not defined at new LocalStorage @feathers-localstorage/lib/index.js:32:41

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 28, 2016

@naptiv I've verified that the user does come back with Postgres. Using feathers-authentication@0.4.0. You need to set the idField to 'id' at the root of your auth config section. So:

{
  "host": "localhost",
  "port": 3030,
  "postgres": "postgres://postgres:@localhost:5432/test",
  "public": "../public/",
  "auth": {
    "idField": "id",
    "token": {
      "secret": "a secret"
    },
    "local": {}
  }
}
@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 28, 2016

@naptiv ok so there isn't an issue with this module but there probably is with feathers-localstorage. Let's track that other bug in feathersjs-ecosystem/feathers-localstorage#3. I have some questions there.

@ekryski ekryski closed this Feb 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.