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

Meteor.userId() still returns the id on client when logging out and subscriptions restart #1331

Closed
timhaines opened this Issue Aug 18, 2013 · 6 comments

Comments

Projects
None yet
4 participants
@timhaines
Contributor

timhaines commented Aug 18, 2013

I've got a publish method that throws an error if the user isn't signed in.

If the user happens to be using the app, then signs out while subscribed to this, the subscription gets restarted as expected, and the publisher throws the 'Not signed in error'

However, the error handler for the subscription, when receiving the error from the publisher, seems to think the user is still signed in. i.e. Meteor.userId() returns the user's ID. At this time, I'd expect Meteor.userId() to return null, recognizing the user has signed out. Or if that's not possible, a Meteor.loggingOut() method to show it's in process.

I can provide a simple reproduction if this isn't obvious.

@timhaines

This comment has been minimized.

Contributor

timhaines commented Aug 18, 2013

@zhanghaojie I threw the error in the publisher myself, in order to pass the info to the subscriber in the client. That should be quite separate from the log out process though shouldn't it? i.e. it shouldn't break the logout.

@timhaines

This comment has been minimized.

Contributor

timhaines commented Aug 19, 2013

@zhanghaojie Are you trying to tell me that throwing in a publisher breaks loggingOut by design, and this is not a bug? Or are you suggesting what the problem is to help me work around it?

@zhanghaojie

This comment has been minimized.

zhanghaojie commented Aug 19, 2013

Sorry!!! Forget my answer , I am wrong.

@glasser

This comment has been minimized.

Member

glasser commented Apr 22, 2014

Yeah, I can see why having loggingOut would be attractive (see also #769).

@hwillson

This comment has been minimized.

Member

hwillson commented Jan 19, 2017

I've created PR #8271 to help address this issue (yes, I know, it's been a while ... but better late than never, right? 🙂 ). Thanks!

@hwillson

This comment has been minimized.

Member

hwillson commented Feb 15, 2017

PR #8271 has been merged, so Meteor.loggingOut functionality is coming soon - thanks all!

@hwillson hwillson closed this Feb 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment