2014-05-12 2 views
1

장고 Rest 프레임 워크 API를 Oauth2 툴킷으로 보호했지만 현재 승인 된 요청을 client_id받는 방법을 모르겠습니다. 나는 또한 다른 분명한 힌트하지만 행운을 검사django rest framework에서 OAuth2 client_id에 액세스하는 방법은 무엇입니까?

['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'authenticate', 'authenticate_header', 'www_authenticate_realm'] 

:

['DATA', 'FILES', 'QUERY_PARAMS', '_CONTENTTYPE_PARAM', '_CONTENT_PARAM', '_METHOD_PARAM', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattr__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_auth', '_authenticate', '_authenticator', '_content_type', '_data', '_default_negotiator', '_files', '_load_data_and_files', '_load_method_and_content_type', '_load_stream', '_method', '_not_authenticated', '_parse', '_perform_form_overloading', '_request', '_stream', '_user', 'accepted_media_type', 'accepted_renderer', 'auth', 'authenticators', 'content_type', 'method', 'negotiator', 'parser_context', 'parsers', 'stream', 'successful_authenticator', 'user'] 

다음 나는 내가 가진 successful_authenticator을 검사 :

class RequestTransactionView(APIView): 

    def post(self, request, format=None): 
     transaction = self.parse_dictionary(request.DATA) 
     return Response(str(transaction.goid)) 

내가 준 request 개체를 검사했다.

답변

1

request.auth을 인쇄 할 때 문자열을 받았을 때 문자열 유형이라고 생각했지만 AccessToken이라고 생각 했으므로 거기에서 직접 응용 프로그램을 얻을 수있었습니다.

print request.auth.application 
관련 문제