hI have a meteor.js application where I am doing some custom authentication. I would like to implement a logout that would end the current session. I tried to create a route like the one below and a anchor that directed to that URL:
FlowRouter.route '/logoutUser',
action: (params) ->
console.log "start logout"
Meteor.logout (err) ->
console.log err if err
console.log "after logout"
FlowRouter.go 'login'
console.log "after after"
When users clicked the link and navigated to /logoutUser
, it would change the URL in the nav bar to /logoutUser
, the console would log start logout
, but the user would not be logged out and the callback would never be called. If I manually hit the /logoutUser
url it successfully logs the user out and reaches the callback. I’ve also noticed that if I go into the console and type Meteor.logout()
it still doesn’t appear to be logging the current user out.
Does anyone know why this would be happening? Any idea on how I can successfully log the user out using this method?