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

1.0 authentication service hooks don't run when client uses feathers-socketio #455

Closed
marshallswain opened this Issue Mar 21, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@marshallswain
Copy link
Member

marshallswain commented Mar 21, 2017

The authentication service hooks don't get hit when I use the feathers-socketio transport. In the example, below, the hook only runs if I use feathers-rest.

app.service('authentication').hooks({
  before: {
    create: [function (hook) {
      // OOPS, this only runs during requests from feathers-rest
      console.log(hook);
    }]
  },
  after: {
    create: [authHook(options)]
  }
});

@marshallswain marshallswain added the Bug label Mar 21, 2017

@marshallswain marshallswain changed the title authentication service hooks don't run when client uses feathers-socketio 1.0 authentication service hooks don't run when client uses feathers-socketio Mar 21, 2017

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Mar 22, 2017

Really? I'll see if I can reproduce. We've been using auth with an app that was exclusively using sockets and those hooks were being run. Maybe related to #432?

@marshallswain

This comment has been minimized.

Copy link
Member Author

marshallswain commented Mar 22, 2017

@ekryski yeah. They do run as long as authentication passes. I'm currently working on a PR that will hopefully fix this.

The problem is that we manually call authenticate here before creating a token here. I'm hoping I can adapt it to use the authenticate hook, so we can hit those hooks before auth is attempted.

@marshallswain

This comment has been minimized.

Copy link
Member Author

marshallswain commented Mar 22, 2017

You can reproduce this pretty easily by setting up a simple logging before hook on authentication, then botching your password in local auth. Switch back to the correct password and it'll hit, but it's out of order when compared to feathers-rest auth.

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.