Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Socket client should automatically auth on reconnect #2

Closed
marshallswain opened this issue Oct 23, 2016 · 8 comments
Closed

Socket client should automatically auth on reconnect #2

marshallswain opened this issue Oct 23, 2016 · 8 comments

Comments

@marshallswain
Copy link
Member

@marshallswain commented on Wed Oct 12 2016

I'm in the process of making a new version of can-connect-feathers that uses the real feathers-client. This is something that probably ought to be in the feathers-auth client.

  /**
   * When the socket gets disconnected, this makes sure that it re-authenticates
   * upon reconnection. It simply calls `authenticateSocket` and persists
   * the token.
   */
  handleSocketReconnects(data){
    // Make sure the socket re-authenticates if it gets disconnected.
    this.io.on('reconnect', () => {
      this.authenticateSocket(data)
        .then(data => this.persistToken(data))
        .then(data => this.makeSSRCookie(data));
    });
  }
@marshallswain
Copy link
Member Author

marshallswain commented Oct 25, 2016

related to feathersjs-ecosystem/authentication#272

@ekryski
Copy link
Member

ekryski commented Nov 22, 2016

I thought this was complete but there is a bug so I'm not going to close this just yet. I'm not testing a server shutdown only emitting a reconnect event from the server, which works but that doesn't accurately reflect a real world disconnect.

@ekryski ekryski mentioned this issue Nov 23, 2016
@ekryski
Copy link
Member

ekryski commented Nov 23, 2016

Closed by #9. Released in v0.1.2

@ekryski ekryski closed this as completed Nov 23, 2016
@efgonz
Copy link

efgonz commented Apr 13, 2017

@marshallswain @ekryski After #9 feathers deals with reconnection or it needs any configuration? I'm having a lot of problems with reconnection.

@marshallswain
Copy link
Member Author

@efgonz can you describe in more detail the problems you are seeing?

@efgonz
Copy link

efgonz commented Apr 13, 2017

Thanks for answering @marshallswain, I have looked around and your support is awfully good here. Describing my issue: I have gotten into feathers js in a new team, so I'm new with it , they have "feathers-authentication": "0.7.12", and they decided that won't migrate to v.1 where I can see that to implement re-authentication after server goes down or the client loses connectivity is supported and simple with feathers-authentication-client, but for v.0.7, what are my options? Thanks in advanced.

@marshallswain
Copy link
Member Author

marshallswain commented Apr 13, 2017

@efgonz you'll need to setTimeout at login to call app.authenticate again with the JWT.

Sorry. Lots of stuff going on. You can see the code that we use to reauthenticate in the feathers-authentication-client, here: https://github.com/feathersjs/feathers-authentication-client/blob/master/src/passport.js#L172

and the upgrade handling here: https://github.com/feathersjs/feathers-authentication-client/blob/master/src/passport.js#L61

@efgonz
Copy link

efgonz commented Apr 13, 2017

@marshallswain I already based on feathers-authentication-client and works perfectly , thank you for the support.

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

No branches or pull requests

3 participants