Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found this in the tastypie source code. Basically implies that HTTP POST is not supported by SessionAuthentication. </p> <pre><code>class SessionAuthentication(Authentication): """ An authentication mechanism that piggy-backs on Django sessions. This is useful when the API is talking to Javascript on the same site. Relies on the user being logged in through the standard Django login setup. Requires a valid CSRF token. """ def is_authenticated(self, request, **kwargs): """ Checks to make sure the user is logged in &amp; has a Django session. """ # Cargo-culted from Django 1.3/1.4's ``django/middleware/csrf.py``. # We can't just use what's there, since the return values will be # wrong. # We also can't risk accessing ``request.POST``, which will break with # the serialized bodies. if request.method in ('GET', 'HEAD', 'OPTIONS', 'TRACE'): return request.user.is_authenticated() </code></pre> <p>So answering my own question here but if someone can explain it better and suggest a good way to do this, that would be great too.</p> <p>Edit</p> <p>I am currently using a workaround from <a href="https://github.com/amezcua/TastyPie-DjangoCookie-Auth/blob/master/DjangoCookieAuth.py" rel="nofollow">https://github.com/amezcua/TastyPie-DjangoCookie-Auth/blob/master/DjangoCookieAuth.py</a> which basically is a custom authentication scheme that fetches the <code>session_id</code> from the cookie and checks with the backend if it is authenticated. Might not be the most full proof solution but works great.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload