Skip to content

中间件不兼容overtrue/socialite新版本 #380

@aiysya

Description

@aiysya

我用的环境 lnmp

  • PHP 版本:7.4.6
  • laravel-wechat :5.0.4
  • overtrue/wechat 版本:4.2.25
  • overtrue/socialite dev-devleop

问题及现象

使用 中间件 'wechat.oauth' => \Overtrue\LaravelWeChat\Middleware\OAuthAuthenticate::class,
报错Trying to get property 'headers' of non-object

排查依赖的 overtrue/socialite 返回内容有变
overtrue/socialite 2.*
https://github.com/overtrue/socialite/blob/2.0.16/src/Providers/AbstractProvider.php#redirect 返回为对象\Symfony\Component\HttpFoundation\RedirectResponse
新版本https://github.com/overtrue/socialite/blob/develop/src/Providers/Base.php 返回为string

修改:https://github.com/overtrue/laravel-wechat/blob/master/src/Middleware/OAuthAuthenticate.php#63
return $officialAccount->oauth->scopes($scope)->redirect($request->fullUrl());
为 return redirect()->to($officialAccount->oauth->scopes($scope)->redirect($request->fullUrl()));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions