Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在企业微信中,withAccessToken与文档中的示例不符 #2764

Closed
Guxinpei opened this issue Dec 1, 2023 · 1 comment
Closed

在企业微信中,withAccessToken与文档中的示例不符 #2764

Guxinpei opened this issue Dec 1, 2023 · 1 comment

Comments

@Guxinpei
Copy link

Guxinpei commented Dec 1, 2023

我用的环境

  • PHP 版本:8.1
  • overtrue/wechat 版本:"w7corp/easywechat": "^6.7"
  • 是否使用了框架?框架名称:Laravel

问题及现象

use EasyWeChat\Work\Application;
 $config = [...$someConfig];
 (new Application($config))->getClient()->withAccessToken('access_token'); 
 //此处会抛出异常
 //EasyWeChat\Kernel\HttpClient\AccessTokenAwareClient::withAccessToken(): Argument #1 ($accessToken) must be of type EasyWeChat\Kernel\Contracts\AccessToken, string given

根据我们提供的文档 https://easywechat.com/6.x/client.html#%E8%87%AA%E5%AE%9A%E4%B9%89-access-token

$client->withAccessToken('access_token');
$client->get('xxxx');
$client->post('xxxx');

很明显此处应当是一个string参数,但实际上AccessTokenAwareClient类中withAccessToken方法接受的事EasyWeChat\Kernel\Contracts\AccessToken

@overtrue
Copy link
Collaborator

overtrue commented Dec 5, 2023

谢谢,已更新

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants