I need a solution that works with magic cookies as well, to my knowledge login() does not work for this. There's also no hook that is thrown in that case.