Accounts.onLogin server side url/route/path?

I’m wondering how one would get the nodejs req.url in Meteor from inside Accounts.onLogin callback function?
Meteor.onConnection or ultimately connection.httpHeaders don’t actually contain the path of the request.
I suspect the idea of a path is unrelated to the login function.
Is there something that is called after onLogin in this situation?
This situation I believe only happens when you are hot reloading. It doesn’t reload the route? so what do people do? Session.set/get route won’t work because onLogin errors Session unknown, etc.
Anyway in nodejs you get a req and can access the url.

Hi, looks like I have a similar question like yous. Please, if you find the a solution, write it here.

Are you trying to find out which page the user logged in from? There is no req.url since login in meteor is a websocket message, not an http request.

Yes I am hoping to get the path of the clients browser.
It’s when you restart meteor that the session finds it back up and triggers an onLogin but it doesn’t call the route in the Router.map. (I’m just using Iron Router from an under-development internal package).

api.use(['iron:router@1.0.12', 'iron:layout@1.0.12']);

I also noted this issue.


Although that’s a nice feature too.
It appears to me there simply is not the req.url but it is hidden somewhere and is not a stretch to simply include it with the httpHeaders.
This is I believe therefore a warranted request for a feature, to add the url to the httpHeaders found in the argument passed to Accounts.onLogin it’s the best place for it and apparently needed/useful. (who does or how does that occur?)
To the other comment above I wanted to point out the idea of replacing a function something like this.

myObj.orignialFunc = myObj.itsFunc;
myObj.itsFunc = function(passed) {
    passed.addedVar = "missing req.url";
    return myObj.orignialFunc(passed);
}

To augment and insert the extra missing data.
In this case the question is therefor, “Where on the client is the function to augment that calls the onLogin function of Accounts on the server? or aka Hooks?”, for your problem maybe this idea is a useful one.

Okay it looks like the onLogin works on the client so then you can call window.location.pathname and send that to a Meteor.method.

Accounts.onLogin(function() {
    console.log("CLIENT onLogin called from url:", window.location.pathname);
});

so…

Accounts.onLogin(function() {
    //console.log("CLIENT OnLogin called from url:", window.location.pathname);
    Meteor.call('loginFromPath', window.location.pathname, function (err) {
        if(err) console.log(err);
    });
});

Still I think adding the url to the httpHeaders in the servier side onLogin passed argument is better and more efficient.