예제 #1
0
파일: views.py 프로젝트: jingyuyao/kaas
    def destroy(self, request, *args, **kwargs):
        token = self.get_object()
        oauth_client = token.oauth_client
        access_token = token.access_token
        token.delete()

        # Process is not uniform across different companies
        if oauth_client.name == 'reddit':
            auth = (oauth_client.client_id, oauth_client.client_secret)
            data = {'token': access_token}

            r = requests.post(oauth_client.revoke_url, data, auth=auth, headers=self.HEADERS)
            if r.status_code < 300:
                return responses.success_response('Token deleted.')
            else:
                return responses.error_response('Revoke token error.')
예제 #2
0
파일: views.py 프로젝트: jingyuyao/kaas
 def delete(request, *args, **kwargs):
     logout(request)
     return responses.success_response('Logged out')