N
N
nikitahudkov2021-01-25 16:28:16
PHP
nikitahudkov, 2021-01-25 16:28:16

Why can't get a token?

I do authorization on the site through VK, I can’t get a token, it is not displayed.
Here is the page with the login button:

<?php 

  include 'config.php';

?>

<p><a href="https://oauth.vk.com/authorize?client_id=<?=ID?>&display=page&redirect_uri=<?=URL?>&response_type=code&v=5.52" target="_blank">Войти через ВК</a></p>


Here is the page with the code itself:
<?php  

  if (!isset($_GET['code'])) {
    	exit('Error');
  	}

  	include 'config.php';

  	$token = json_decode(file_get_contents('https://oauth.vk.com/access_token?client_id='.ID.'&redirect_uri='.URL.'&client_secret='.SECRET.'&response_type=code&v=5.52'.$_GET['code']), true);

  	print_r($token);

?>


id, secret, url are correct in config.php file. help me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HemulGM, 2021-01-25
@HemulGM

So can you still recognize the response code and errors and show them?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question