Unfortunately Instagram API doesn't give endpoint, which allows to log user out. Answer, which you reference to, recommends to use intercept url with html page - it'll load logout url in iframe and redirect to auth website. So you won't really log out user - he'll be logged out just before auth process.
Html for loading page can be as follows:
<html>
<body>
<script type="text/javascript">
function load() {
window.location.href = "https://YOURS_AUTH_INSTAGRAM_URL";
}
</script>
<iframe src="https://instagram.com/accounts/logout/""
onload="load()"
width="0" height="0">
</iframe>
</body>
</html>