Thanks Matias! got it done.
For the benefit of others and if you notice there could be an improvement...:
views.py
from rest_framework.views import APIView
class TokenView(APIView):
authentication_classes = (SessionAuthentication,)
permission_classes = (permissions.IsAuthenticated,)
def get(self, request, format=None):
if not request.user.is_authenticated:
return Response({'status': 'Not Authenticated'})
account = Account.objects.get(email=request.user.email)
token = account.auth_token.key
provider = account.social_auth.get().provider
serializer = TokenSerializer(data=request.DATA)
if serializer.is_valid():
return Response({'status': 'OK', 'token': token, 'provider': provider})
else:
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
serializers.py
from rest_framework.serializers import Serializer
class TokenSerializer(serializers.Serializer):
class Meta:
model = Account
urls.py
url(r'social-auth', views.TokenView.as_view()),