Refactor token utility, introduce json based redirects for post requests