Fix to token grabbing url  (redirection issues because of malformed url)