Why I have displayed that I am not an authorized user when you run the script,even though I went?

Good day!Try to explain the situation.I run the script on your site to find out the id in the VC visits the customer's website.And when I visit the website I have displayed that I am not authorized,even though I authorized.But if I go from an account that has an application on this website,it gives me id.Tell me how to do what you could to find out the id of any user who visits the site?
Here is the code:

 <script src="//vk.com/js/api/openapi.js"></script>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script language="javascript">
window.onload = (function() {
 apiId: 6637768 //id of the connected site
 function authInfo(response) 
 if (response.session)
 document.getElementById('t').innerHTML = "Your ID:" + response.session.mid;
 document.getElementById('t').innerHTML = 'You are not logged in Vkontakte.';
<div id="t"></div>

June 3rd 19 at 19:21
0 answer

Find more questions by tags JavaScriptHTMLVKontakte