Ejemplo n.º 1
0
    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.')
Ejemplo n.º 2
0
 def delete(request, *args, **kwargs):
     logout(request)
     return responses.success_response('Logged out')