Answer the question
In order to leave comments, you need to log in
Working with vk api without authorization?
Good day comrades, I'm trying to get the user id on the site, in response I get status: "not_authorized"
<script src="https://vk.com/js/api/openapi.js?146" type="text/javascript"></script>
<script type="text/javascript">
function checkVk() {
VK.init({
apiId: '*****'
});
function authInfo(response) {
console.log(response);
if (response.session) {
console.log(response.session.mid);
alert(response.session.mid);
}
}
console.log(VK.Auth.getLoginStatus(authInfo));
}
checkVk();
</script>
VK.Api.call('users.get', {}, function(r) {
if(r.response) {
alert('Привет, ' + r.response[0].first_name + ' '+ r.response[0].last_name);
}
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question