Answer the question
In order to leave comments, you need to log in
How to get token from blank.html?
Hello everyone, there is a problem, help me figure it out, the idea is this:
So I want to get a token through oauth blank.html, if I do it in the browser, I type the following into the address bar:
https://oauth.vk.com/authorize?client_id=51&displa... - the answer comes to us the text, in the address bar the token itself The
question is how to make everything code and what would redirect us to another page after receiving the token?
Did it like this:
<script type="text/javascript">
$.ajax({
url: 'https://oauth.vk.com/authorize?client_id=51&display=page&redirect_uri=https://oauth.vk.com/blank.html&scope=offline,messages&response_type=token&v=5.37',
type: 'GET',
dataType: 'jsonp',
crossDomain: true,
});
</script>
Answer the question
In order to leave comments, you need to log in
using the "VKONTAKTE API PHP HTML JQUERY" specified in the tags, this will not work, because you cannot set https://oauth.vk.com/blank.html . this is possible only for standalone applications, that is, desktop and mobile, but not for the web.
for your case, you need to put redirect_uri on the page on your domain and catch it there.
just keep in mind that you will not get "messages" rights, they are given only for standalone applications !!!
so if you want to use correspondence, the only option is to send the user to the URL you specified and force them to copy the token from there. Naturally, this will work only for their own, outsiders are not all fearless - they will agree to copy when it says "do not copy" on the page.
PS
I was wondering why you need access to messages, I thought you want to spam.
if this is for a chat How to make a chat in the VK application? - then the answer is to chat on your server, and not through internal VK messages. that's it.
good luck in general.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question