Fixes an issue where OAUTH2_CODE is replaced only for the javascript code rather than the HTML.
Fixes an issue where HTTP 400 is not properly handled at the page.