I’ve got a seemingly simple situation that I’ve gotten super confused about. At a certain route, I need to validate a token by looking it up in a collection. Then I either show a different template or just render the same one differently using helpers. As far as I can tell, I have the following options:
Check in iron router’s
onBeforeAction—but it’s unclear how I would get access to the collection; I assume I’d have to publish a special parameterized publication just for this purpose? Seems inelegant.
Use a Meteor Method call in the template’s
onCreatedblock, then set a Session variable based on the results.
Right now I’m leaning towards the latter, but I’m curious if I’m missing something obvious for such a seemingly common task.