/
authMobile.php
30 lines (22 loc) · 927 Bytes
/
authMobile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
require_once 'vendor/autoload.php';
$vk = new \Zelenin\VK;
$client_id = '';
$scope = 'notify,friends,photos,audio,video,docs,notes,pages,status,offers,wall,groups,notifications,stats,ads,offline,nohttps';
$redirect_uri = 'http://home.zelenin.me/VK/authMobile.php?access_token';
$response = $vk->authMobile( $client_id, $scope, $redirect_uri, 'page' );
?>
<script>
var hash = window.location.hash.slice( 1 );
var parts = hash.split( '&' );
var values, hash_array = {};
for ( i = 0; i < parts.length; i++ ) {
values = parts[i].split( '=' );
hash_array[values[0]] = values[1];
}
var access_token = hash_array.access_token;
document.write( '<p>access token: ' + hash_array.access_token + '</p>' );
document.write( '<p>expires_in: ' + hash_array.expires_in + '</p>' );
document.write( '<p>user_id: ' + hash_array.user_id + '</p>' );
document.write( '<p>secret: ' + hash_array.secret + '</p>' );
</script>