Skip to content

Commit b9b96db

Browse files
committed
Auth now returns Response\Auth object
1 parent 36def78 commit b9b96db

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/getjump/Vk/Auth.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ public function getToken($code)
164164
$data = $this->guzzle->get($uri)->json(['object' => true]);
165165

166166
if (isset($data->access_token)) {
167-
// POSSIBLY WE SHOULD RETURN OBJECT, WITH USER_ID AND EXPIRES IN, NOT ONLY TOKEN
168-
return $data->access_token;
167+
return new \getjump\Vk\Response\Auth($data->access_token, $data->expires_in, $data->user_id);
169168
} elseif (isset($data->error)) {
170169
// ERROR PROCESSING
171170
}

src/getjump/Vk/Response/Auth.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace getjump\Vk\Response;
4+
5+
6+
class Auth {
7+
8+
public $token = false;
9+
public $expiresIn = false;
10+
public $userId = false;
11+
12+
public function __construct($token = false, $expiresIn = false, $userId = false)
13+
{
14+
$this->token = $token;
15+
$this->expiresIn = $expiresIn;
16+
$this->userId = $userId;
17+
}
18+
}

0 commit comments

Comments
 (0)