Форум программистов, компьютерный форум, киберфорум
Наши страницы
PHP: сети
Войти
Регистрация
Восстановить пароль
 
Whoami39
0 / 0 / 0
Регистрация: 21.06.2018
Сообщений: 1
1

Ошибка ErrorException in Provider.php line 53: Undefined index: response

21.06.2018, 21:42. Просмотров 411. Ответов 1
Метки нет (Все метки)

Помогите в чем ошибка?
in Provider.php line 53
at HandleExceptions->handleError(8, 'Undefined index: response', '/var/www/html/vendor/socialiteproviders/vkontakte/Provider.php', 53, array('token' => array('access_token' => 'e178ced5f09505f54ccf73f2a272b952f0a3b4424825c3d0c681dc83543267ec512edafd71f8c8e0c3999', 'expires_in' => 86400, 'user_id' => 409785214, 'email' => 'botnet.bn@gmail.com'), 'lang' => '', 'response' => object(Response))) in Provider.php line 53
at Provider->getUserByToken(array('access_token' => 'e178ced5f09505f54ccf73f2a272b952f0a3b4424825c3d0c681dc83543267ec512edafd71f8c8e0c3999', 'expires_in' => 86400, 'user_id' => 409785214, 'email' => 'botnet.bn@gmail.com')) in Provider.php line 100
at Provider->user() in AuthController.php line 25
at AuthController->callback('vkontakte')
at call_user_func_array(array(object(AuthController), 'callback'), array('provider' => 'vkontakte')) in Controller.php line 55
at Controller->callAction('callback', array('provider' => 'vkontakte')) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(AuthController), 'callback') in Route.php line 203
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Controller.php line 26
at Controller->App\Http\Controllers\{closure}(object(Request), object(Closure)) in Pipeline.php line 131
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 561
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 520
at Router->dispatchToRoute(object(Request)) in Router.php line 498
at Router->dispatch(object(Request)) in Kernel.php line 174
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in TransformsRequest.php line 30
at TransformsRequest->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ValidatePostSize.php line 27
at ValidatePostSize->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53



Вот сам код

Добавлено через 2 минуты
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
 
namespace SocialiteProviders\VKontakte;
 
use SocialiteProviders\Manager\OAuth2\User;
use Laravel\Socialite\Two\ProviderInterface;
use Laravel\Socialite\Two\InvalidStateException;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;
 
class Provider extends AbstractProvider implements ProviderInterface
{
    protected $fields = ['uid', 'first_name', 'last_name', 'screen_name', 'photo', 'photo_big'];
 
    /**
     * Unique Provider Identifier.
     */
    const IDENTIFIER = 'VKONTAKTE';
 
    /**
     * {@inheritdoc}
     */
    protected $scopes = ['email'];
 
    /**
     * {@inheritdoc}
     */
    protected function getAuthUrl($state)
    {
        return $this->buildAuthUrlFromBase(
            'https://oauth.vk.com/authorize', $state
        );
    }
 
    /**
     * {@inheritdoc}
     */
    protected function getTokenUrl()
    {
        return 'https://oauth.vk.com/access_token';
    }
 
    /**
     * {@inheritdoc}
     */
    protected function getUserByToken($token)
    {
        $lang = $this->getConfig('lang');
        $lang = $lang ? '&lang='.$lang : '';
        $response = $this->getHttpClient()->get(
            'https://api.vk.com/method/users.get?user_ids='.$token['user_id'].'&fields='.implode(',', $this->fields).$lang.'&https=1'
        );
 
        $response = json_decode($response->getBody()->getContents(), true)['response'][0];
 
        return array_merge($response, [
            'email' => array_get($token, 'email'),
        ]);
    }
 
    /**
     * {@inheritdoc}
     */
    protected function mapUserToObject(array $user)
    {
        return (new User())->setRaw($user)->map([
            'id' => array_get($user, 'uid'), 'nickname' => array_get($user, 'screen_name'),
            'name' => trim(array_get($user, 'first_name').' '.array_get($user, 'last_name')),
            'email' => array_get($user, 'email'), 'avatar' => array_get($user, 'photo'),
        ]);
    }
 
    /**
     * {@inheritdoc}
     */
    protected function getTokenFields($code)
    {
        return array_merge(parent::getTokenFields($code), [
            'grant_type' => 'authorization_code',
        ]);
    }
 
    /**
     * {@inheritdoc}
     */
    protected function parseAccessToken($body)
    {
        return json_decode($body, true);
    }
 
    /**
     * {@inheritdoc}
     */
    public function user()
    {
        if ($this->hasInvalidState()) {
            throw new InvalidStateException();
        }
 
        $user = $this->mapUserToObject($this->getUserByToken(
            $token = $this->getAccessTokenResponse($this->getCode())
        ));
 
        return $user->setToken(array_get($token, 'access_token'));
    }
 
    /**
     * Set the user fields to request from Vkontakte.
     *
     * @param array $fields
     *
     * @return $this
     */
    public function fields(array $fields)
    {
        $this->fields = $fields;
 
        return $this;
    }
 
    /**
     * {@inheritdoc}
     */
    public static function additionalConfigKeys()
    {
        return ['lang'];
    }
}
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
Similar
Эксперт
41792 / 34177 / 6122
Регистрация: 12.04.2006
Сообщений: 57,940
21.06.2018, 21:42
Ответы с готовыми решениями:

Выдает ошибку Notice: Undefined index: Hall_Theatre_idTheatre in C:\xampp\htdocs\CourseWork\FindSeance.php on line 7
прошу помощи. Создаю выпадающее меню с помощью MySQL, PHP и JavaScript....

Ошибка Fatal error: Cannot redeclare Point::getX() in E:\OpenServer\domains\test.ru\index.php on line 15
Fatal error: Cannot redeclare Point::getX() in...

ошибка Fatal error: Class 'Point' not found in E:\OpenServer\domains\test.ru\index.php on line 13
&lt;?php class Poin{ public $x; public $y; public function...

ошибка Parse error: syntax error, unexpected end of file in E:\OpenServer\domains\test.ru\index.php on line 23
&lt;!DOCTYPE html&gt; &lt;html lang=&quot;ru&quot;&gt; &lt;head&gt; &lt;title&gt;Калькулятор&lt;/title&gt; &lt;/head&gt;...

Warning: Illegal string offset 'text' in Z:\domains\phpsite\index.php on line 26 m
Добрый день! Помогите разобраться что не так! Выдает ошибку: &quot;Warning:...

1
alexsamos33
618 / 598 / 325
Регистрация: 26.04.2014
Сообщений: 1,970
25.06.2018, 11:46 2
Значит vk вернул ошибку. Когда возникает ошибка, например, неверные параметры, устаревший / неверный токен и т.д. выводится ошибка, а response отсутствует.
PHP
52
53
54
55
        $error = json_decode($response->getBody()->getContents(), true)['error'];
 
/* затем проверь */
var_dump($error);
0
MoreAnswers
Эксперт
37091 / 29110 / 5898
Регистрация: 17.06.2006
Сообщений: 43,301
25.06.2018, 11:46

Fatal error: Call to a member function close() on a non-object in ....index.php on line 237
нужна помощь вставляю код пхп приведенный ниже в шаблон DLE все супер...

ошибка Notice: Undefined index
поменял на серваке версию php после чего появились такие вот сообщения ...

ошибка Fatal error: Function name must be a string in E:\OpenServer\domains\test.ru\5.php on line 27
&lt;?php $list = array(); $list = array(15, &quot;22&quot;, &quot;My string&quot;, true); echo...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Опции темы

КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Рейтинг@Mail.ru