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

间接性的出现错误OfficialAPIError: 40001 #70

Closed
dragon-along opened this issue Mar 26, 2016 · 3 comments
Closed

间接性的出现错误OfficialAPIError: 40001 #70

dragon-along opened this issue Mar 26, 2016 · 3 comments
Assignees

Comments

@dragon-along
Copy link

File "/home/wechat_sdk/basic.py", line 883, in _check_official_error
raise OfficialAPIError("{}: {}".format(json_data["errcode"], json_data["errmsg"]))
OfficialAPIError: 40001: invalid credential, access_token is invalid or not latest hint: [9.ZaUa0975vr21]

自从升级sdk后,间接性的出现40001错误,请问如何解决?

@yarving
Copy link

yarving commented Apr 1, 2016

@dragon-along 你查看下接口权限的获取access_token是不是被消耗完了。

@doraemonext
Copy link
Owner

可能是 access token 维护问题,参考 http://wechat-python-sdk.com/quickstart/wechatconf/

如果还是有问题,希望能提供更详细的日志信息。

@sunsongxp
Copy link

这个问题可能是因为你部署的时候,起了多个进程,每个进程都去微信的服务器获取一次access_token,只有最后一个获取到的access_token才有效,比如,如果你用gunicorn去启django,并设置4个进程,那么你会发现,每上传4个图片可能只有一个成功,其它都失败。我就遇到这个问题了。

access_token是公众号的全局唯一接口调用凭据,公众号调用各接口时都需使用access_token。开发者需要进行妥善保存。access_token的存储至少要保留512个字符空间。access_token的有效期目前为2个小时,需定时刷新,重复获取将导致上次获取的access_token失效。

@doraemonext doraemonext self-assigned this Jul 24, 2016
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

4 participants