Fixes token handling and cancel urls.