meteor-rest
meteor-rest copied to clipboard
Meteor.userId throwing error on method call
Hi, I'm using simple:rest-accounts-password to authenticate the users, and when I make a call to one of my methods that makes use of Meteor.userId() using POST to /methods/myMethodName I get the following exception:
Meteor.userId can only be invoked in method calls. Use this.userId in publish functions.
If I use this.userId, I get a correct identification, but that shouldn't be the way of using it inside a meteor method. Am I missing something? Thank you.
I also have this issue. See #54
oh okay I see, thank you for replying
there is a pull request which resolves this issue
I have the same problem. Has any solve?
yes, the pull request solves this issue.
Merge already? I still have this problem.
the pull request means that it is not yet merged. you will have to merge it yourself locally or wait for it to be merged.
Thanks again, what #... of pull?
Also having this issue... any ideas?? WE only use OAuth logins - Facebook and Spotify currently. Adding the simple:rest-accounts-password package didnt fix it. Using simple:rest 1.1.1
This issue still hasn't been resolved. For those wondering why, it is essentially stuck on an old meteor method api whereby instead of allowing Meteor.user() or Meteor.userId() to be resolved it instead is setting this.userId. So you can use this.userId in the meantime, but not ideal if you want your methods to also work as normal methods.
Is this going to be merged soon?
I notice that Fiber.current._meteorDynamics is not defined so a quick hack would not be possible.