Answer the question
In order to leave comments, you need to log in
How to properly set up a redirect in a frame (VK authorization)?
Hello everybody!
Everything works for me, I just don’t like how it’s implemented, so I’m asking for advice here))
There is an application for bitrks24. It works in a frame. It has a couple of inputs (among others) for the community id in VK and access_token also for VK. To get this access_token, I need to first get some code , and then using this code to get an access_token . And write this access_token to the input from the frame (as mentioned at the beginning).
I'm using PHP SDK VK which is provided by VK itself. How it all works
The first file is getCode.php
$vk = new VK\Client\VKApiClient();
$code = $vk->getCode();
echo $code;
if (isset($_GET['code'])) {
$oauth = new VK\OAuth\VKOAuth();
$code = $_GET['code'];
$response = $oauth->getAccessToken($code);
$access_token = $response['access_token'];
?>
<?php
if (!empty($access_token)) {
?>
<div>
<p>Ваш access_token</p>
</div>
<div>
<p><?php echo $access_token ?></p>
</div>
<?php } ?>
Answer the question
In order to leave comments, you need to log in
I think in your simple case, it's better to use css :focus for this .
Here .
If you are not familiar with technologies, click on the down arrow and there view compile.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question