Updated app to run on HTTPS
Added error handling for /authcode endpoint