[WIP] Make new authentication request more flexible and with Ajax request support

- [ ] Add specs
@ZenCocoon Perhaps we should return the full url here instead of just the path?