Django request.POST is empty
Im using django, allauth and dj-rest-auth. I'm implementing apple sign in. There is an issue with apple that I need multiple client_id's configured, its because you need a different one for ios en android/web. The issue is discussed here: https://github.com/pennersr/django-allauth/issues/2718 With also some solutions.
Anyway, my question is not about that issue. I'm trying to implement a solution but django is not working like I expect it to. The issue is that that I cant access request.POST
data. Which I think should be possible.
# We add client_id when we make the post request, and we use it to filter for it
def list_apps(self, request, provider=None, client_id=None):
print(request.POST) --> returns empty dict
# print(request.body) --> error
# print(request.data) --> error
assert False
print(request.POST.get('client_id'))
apps = super().list_apps(request=request, provider=provider, client_id=client_id)
return apps
request.body
gives the error:
django.http.request.RawPostDataException: You cannot access body after reading from request's data stream
request.data
gives the error:
AttributeError: 'WSGIRequest' object has no attribute 'data'
I would expect that I can access at least one of request.body
, request.data
or request.POST
. Or else how can I access my posted data?