I found the following question on Stackoverflow: Call Instagram API from local host however the answers are mostly related to php. I used Login with Instagram Using OAuth 2.0 in Java Servlets but as we all know it only works on external server. I looked into methods to make my localhost on Windows publicly available, but it failed.
There tools like ngrok to securely expose a local web server to the internet and capture traffic, I couldn't get it to work and so far it results HTTP 500 - exact result as I was using localhost:8080.
javax.servlet.ServletException: java.lang.NullPointerException
com.instalogin.CallbackServlet.doGet(CallbackServlet.java:130)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NullPointerException
com.instalogin.CallbackServlet.getWebContentFromURL(CallbackServlet.java:65)
com.instalogin.CallbackServlet.doGet(CallbackServlet.java:103)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Perhaps the tool that I have used is not good, or I need to do an additional task. I'm pretty sure that, it is possible, and I'm just missing a small piece of a puzzle.