diff --git a/lib/controllers/authorization-controller/index.js b/lib/controllers/authorization-controller/index.js index df80f9ec..fa30712d 100644 --- a/lib/controllers/authorization-controller/index.js +++ b/lib/controllers/authorization-controller/index.js @@ -149,13 +149,12 @@ module.exports = class AuthorizationController { const requestUrl = request.url; const requestQuery = url.parse(requestUrl, true).query; + // Response from the browser with authentication code if (requestUrl.startsWith("/cb?code")) { response.end(messages.ASK_SIGN_IN_SUCCESS_MESSAGE); ui.confirmAllowSignIn((error, confirmSignInChoice) => { - // After confirmed or not browser sign in, closes the socket/port - // with server.destroy(). - // We need to keep the port open so a local hacker is not be able to - // open that port until we get an answer in confirmAllowSignIn + // Closing the socket port with server.destroy() only after confirmation question. + // See https://github.com/alexa/ask-cli/issues/476 server.destroy(); if (error) {