This can happen if the code is expired. They expire pretty quickly by default. You can look up your code in the Django admin under Grants and change the expiration date to far in the future.
原因:
Django OAuth Toolkit 默认的Grant过期时间非常短暂。
Django使用django-oauth-toolkit无法使用json格式进行Oauth2认证:http://www.tuicool.com/articles/7ryYfuq
在django中实现QQ登录
放置“QQ登录”按钮:_OAuth2.0:http://wiki.open.qq.com/wiki/website/%E6%94%BE%E7%BD%AE%E2%80%9CQQ%E7%99%BB%E5%BD%95%E2%80%9D%E6%8C%89%E9%92%AE_OAuth2.0
开发攻略_Server-side :http://wiki.open.qq.com/wiki/website/%E5%BC%80%E5%8F%91%E6%94%BB%E7%95%A5_Server-side
参考资料:
http://stackoverflow.com/questions/27056272/django-oauth-toolkit-invalid-grant-error