Answer the question
In order to leave comments, you need to log in
Getting the First Name, Last Name and User ID through the VK API - how to implement?
It is required to get the user id (well, first name / last name). The VK API is initialized normally, here is the code for the https://vk.com/dev/account.getProfileInfo method
VK.api("account.getProfileInfo", function (data) {
alert("Info: " + data.first_name + " " + data.last_name + " " + data.id);
console.log("Info: " + data.first_name + " " + data.last_name + " " + data.id);
returnStr = data.id;
});
Answer the question
In order to leave comments, you need to log in
Solution - code to get ID
VK.api("users.get", {"v":"5.124"}, function (data) {
var id = data["response"][0]["id"];
returnStr = id;
});
This method can be called with a user access key obtained in the Standalone application via Implicit Flow.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question