how to access POST data inside tastypie custom Authentication

前端 未结 4 1263
北荒
北荒 2021-01-02 04:58

I\'m trying to write custom Authentication in tastypie. Basically, I want to do the authentication using the post parameters and I don\'t want to use the django auth at all,

4条回答
  •  借酒劲吻你
    2021-01-02 05:18

    This error occurs when you access request.body (or request.raw_post_data if you're still on Django 1.3) a second time or, I believe, if you access it after having accessed the POST, GET, META or COOKIES attributes.

    Tastypie will access the request.body (raw_post_data) attribute when processing PUT or PATCH requests.

    With this in mind and without knowing more detail, I would:

    • Check if this only happens for POST/PUTs. If so, then you would have to do some overriding of some tastypie methods or abandon your approach for authentication.
    • Look for places in your code where you access request.body (raw_post_data)
    • Look for calls on 3rd party modules (perhaps a middleware) that might try to access body/raw_post_data

    Hope this helps!

提交回复
热议问题