2012-06-21 3 views
0

사람들이 FB를 통해 내 사이트에 로그인 할 수있게하려면 django-socialregistration 앱을 사용하고 있습니다.페이스 북에 로그인 할 수 없습니다. (django-socialregistration)

Credentials could not be validated, the provider returned no access token. 

함수에서 반환되는 응용 프로그램의 설정 오류입니다 : 그것은 잘 작동하지만 페이스 북 것이 FB에 사용자 로그인 한 후이 오류를 반환 유지 트위터

http://django-socialregistration.readthedocs.org/en/latest/index.html 

(해당 앱과 함께 제공) :

def get_access_token(self, code=None, **params): 
    """ 
    Return the memoized access token or go out and fetch one. 
    """ 
    if self._access_token is None: 
     if code is None: 
      raise ValueError(_('Invalid code.')) 

     self.access_token_dict = self._get_access_token(code, **params) 
     try: 
      self._access_token = self.access_token_dict['access_token'] 
     except KeyError, e: 
      raise OAuthError("Credentials could not be validated, the provider returned no access token.") 

그래서 나는 어떤 액세스 토큰도 발견되거나 검색되지 않는다고 생각합니다.

이 내가 가지고있는 URL을 입력 반환하지만 페이스 북의 디버거 도구,

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC- html40/loose.dtd"> 
<html> 
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head> 
<body><p>Session expired.</p></body> 
</html> 

그리고 이것은 URL입니다 :

www.site.com/social/facebook/callback/?code=AQCb0lWCOTKFYaCQ43imfKvsMgo-8wyA8aq1WxZDWuCel2868I6gou2rn4bN2kTyuL14FxR9cCvrilJB2R5-JOnQqCvo7ihQAi9outrUB81MQdU-XA-5ur7MT5Wlhz3wkb5bc0fwzUYYFpSyeHNjFrIOY6QdZNdrXLcivv1-3qMNOKijLHf0jmZc7bBqPBTkw-Q#_=_ 

그리고 FB 디버거 등의 응답 코드 말한다는 200

입니다

누구든지 무슨 일이 일어나고 있는지 알고 있습니까?

답변

0

아마도이 질문에 대한 해결책은 아니지만 잘못된 정보에 대해 조금 더 많은 정보를 얻을 수 있습니다.

access_token_dict에 표준 출력 덤프 위의 코드를 변경 : 인해 초기화 및 콜백 URL의 불일치에

def get_access_token(self, code=None, **params): 
     """ 
     Return the memoized access token or go out and fetch one. 
     """ 
     if self._access_token is None: 
      if code is None: 
       raise ValueError(_('Invalid code.')) 

      self.access_token_dict = self._get_access_token(code, **params) 
      try: 
       self._access_token = self.access_token_dict['access_token'] 
      except KeyError, e: 
       print self.access_token_dict 
       raise OAuthError("Credentials could not be validated, the provider returned no access token.") 

socialregistration 가장 일반적인 오류가 발생을 - 예를 들어, 당신이 http://localhost:8000에서 시작 http://127.0.0.1:8000/*/callback/로 다시 리디렉션 Django는 귀하의 localhost 세션에 액세스 할 수 없습니다. 여기

+0

git hub에서 문제를 열어 주시겠습니까? – tamara

+0

개발 로컬 버전으로 작업하고 있지 않기 때문에 인쇄 할 수 없습니다. – tamara

+0

예, Github에서 문제를 여는 것이 더 나을 것 같습니다. –

0

(http://developers.facebook.com으로 이동하여 appplication로 이동 -> 설정 -> 고급) 및 화이트리스트에 서버 IP를 추가 할 수 있습니다.

여기에서이 문제를 해결했습니다.