0

I'm using django-social-auth to authenticate users for facebook login for my website.

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

This correctly leads me to an auth dialog, but then when I click "Go To App" in the dialog I get this error from social auth:

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

My requirements file is pointing to a forked version of django-social-auth so I could put some print statements around the error. The failure seems to occur after making a call to

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]

The error I'm getting from that is

{
      "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
   }
}

However if i add a slash to the end of the url I get this error:

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

I assure you that app_id is correct

I know this has been a long read but does anyone have any suggestions on how to fix this?

mea36
  • 746
  • 2
  • 9
  • 17
  • 1
    Why are you attaching ``redirect_uri`` to the ``socialauth_begin`` URL? – omab Dec 16 '12 at 14:53
  • That's a really good question. My coworker wrote that, not me. I removed the `redirect_uri` and I still have the same problem. Thanks for pointing that out though – mea36 Dec 17 '12 at 00:26

1 Answers1

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.

mea36
  • 746
  • 2
  • 9
  • 17