I am using Django-Rest-Framework with token authentication. In my Android App I want to open a webview and display some content from a view which needs authentication.
Because of this I wrote a rest call to fetch a session id.
/rest/getsessionid/ => looks like that:
from django.contrib.sessions.backends.db import SessionStore
class GetSessionKeyView(APIView):
def get(self, request, format=None):
if request.user.is_authenticated:
s = SessionStore()
s.create()
return Response({'sessionid': s.session_key})
return Response({'notauthenicated': True})
Unfortunately the returned sessionid is not working. Why?