0

我正在使用 django-social-auth 对用户进行身份验证,以便登录我的网站。

<a href="{% url socialauth_begin 'facebook' %}?redirect_uri={{SITE_URL}}complete/facebook/">

这正确地引导我进入身份验证对话框,但是当我在对话框中单击“转到应用程序”时,我从社交身份验证中收到此错误:

Request Method: GET
Request URL:    http://[site_url]/complete/facebook/?state=DHlD9efEDau286xRGn2HtVpZ9AbooD3y&code=AQCACZRE3WYGMyBSII1eD-H8Sl8yDUtL6VoZ4qJPKSQ_NDBAoE_6JE7-4Ef353utpAygCZVJMUKiLNs_evC-y2oezOKRsH_njtFZW4FwPE2XoaFm14sdbtUkj1QsqivY6DSpGpsmTNCCs3twYxx-6_C-e1OWEcnd4x6SoBg59LmCUsWhocu739h_ppdLRR_wPjY
Django Version: 1.3.1
Exception Type: AuthFailed
Exception Value:    
Authentication failed: There was an error authenticating the app
Exception Location: /app/.heroku/src/social-auth/social_auth/backends/facebook.py in auth_complete, line 131Request Method: GET
Request URL:    http://[site_url]/complete/facebook/?state=DHlD9efEDau286xRGn2HtVpZ9AbooD3y&code=AQCACZRE3WYGMyBSII1eD-H8Sl8yDUtL6VoZ4qJPKSQ_NDBAoE_6JE7-4Ef353utpAygCZVJMUKiLNs_evC-y2oezOKRsH_njtFZW4FwPE2XoaFm14sdbtUkj1QsqivY6DSpGpsmTNCCs3twYxx-6_C-e1OWEcnd4x6SoBg59LmCUsWhocu739h_ppdLRR_wPjY

我的需求文件指向 django-social-auth 的分叉版本,因此我可以在错误周围放置一些打印语句。失败似乎发生在拨打电话后

https://graph.facebook.com/oauth/access_token?code=AQCc6tIfxJTQN64GGQsDVbT4BCK1hYGypw2oMFQjjMQf-kfJqrWtI-vGe78fJJJHTL6w5yuau90vQu8msVGDpZh30HgUYkwdXhAKJcC9MCf8h6bp1e23wxkkMzP5eaT2j7xOCorn-KgeRv-ZJA40U87GDx1_592amAlSemS4zhXaoAv7JWRHl9NzBFtJ6cuGdbg&client_secret=[app_secret]&redirect_uri=http%3A%2F%2F[site_url]%2Fcomplete%2Ffacebook%2F%3Fredirect_state%3DDHlD9efEDau286xRGn2HtVpZ9AbooD3y&client_id=[app_id]

我从中得到的错误是

{
      "error": {
      "message": "Error validating verification code. Please make sure your redirect_uri is identical to the one you used in the OAuth dialog request",
      "type": "OAuthException",
      "code": 100
   }
}

但是,如果我在 url 的末尾添加一个斜杠,我会收到此错误:

{
   "error": {
     "message": "Error validating application. Invalid application ID.",
     "type": "OAuthException",
     "code": 101
  }
}

我向你保证 app_id 是正确的

我知道这已经读了很长时间,但是有人对如何解决这个问题有任何建议吗?

4

1 回答 1

0

@omab was correct, my issue was attaching the redirect_uri. It addition to that I had edited django-social-auth to append a backslash to the url. This was also incorrect.

于 2012-12-17T17:05:41.267 回答