Skip to content

Commit

Permalink
Auth now returns Response\Auth object
Browse files Browse the repository at this point in the history
  • Loading branch information
getjump committed Oct 18, 2014
1 parent 36def78 commit b9b96db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/getjump/Vk/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ public function getToken($code)
$data = $this->guzzle->get($uri)->json(['object' => true]);

if (isset($data->access_token)) {
// POSSIBLY WE SHOULD RETURN OBJECT, WITH USER_ID AND EXPIRES IN, NOT ONLY TOKEN
return $data->access_token;
return new \getjump\Vk\Response\Auth($data->access_token, $data->expires_in, $data->user_id);
} elseif (isset($data->error)) {
// ERROR PROCESSING
}
Expand Down
18 changes: 18 additions & 0 deletions src/getjump/Vk/Response/Auth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace getjump\Vk\Response;


class Auth {

public $token = false;
public $expiresIn = false;
public $userId = false;

public function __construct($token = false, $expiresIn = false, $userId = false)
{
$this->token = $token;
$this->expiresIn = $expiresIn;
$this->userId = $userId;
}
}

0 comments on commit b9b96db

Please sign in to comment.