Is it possible to use localhost in redirect_uri ? If yes then what I need to do to get it working ?
You might find the following topic helpful in this situation. For testing, you can use any secure site as a redirect (e.g. https://www.hubspot.com). You could also create a self-signed certificate or potentially use something like ngrok. When you push it live you will need to have an encrypted web server to host your front-end app.