Answer the question
In order to leave comments, you need to log in
How to get access_token Vkontakte (problem at the last step)?
I'm trying to get the access_token of the logged in user. The authorization link is formed correctly, a standard dialog appears, then it is redirected to a page with the following content:
$code = $_GET['code'];
$secret = 'dgfgdfgdfgew545'; //секретный ключ приложения
$idapp = '123456'; //id приложения
$url = 'https://oauth.vk.com/access_token?client_id='.$idapp.'&client_secret='.$secret.'&code='.$code.'&redirect_uri=http://site.com/vk.php';
echo $url;
$token = json_decode(file_get_contents($url), true);
var_dump($token);
echo 'Добро пожаловать';
Answer the question
In order to leave comments, you need to log in
https://vk.com/dev/auth_sites - you seem to be doing everything right.
Look at this line $token = json_decode(file_get_contents($url), true); see what file_get_contents returns
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question