Skip to content

Authentication

The three DRF authentication classes: the cookie, the header, and either one without a refusal.

Read from the code itself, so it never falls behind it. The descriptions are the code's own, in English.

CookieAuthentication

Bases: JWTAuthentication

The person the access cookie names - or nobody, never an error.

HeaderAuthentication

Bases: JWTAuthentication

Authorization: Bearer <access token> - for clients that are not browsers.

simplejwt's own class, under the library's name, so a project lists the library's classes together. A bad header is refused, as simplejwt has it. Browsers use the cookie: the frontend never holds a token.

OptionalAuthentication

Bases: JWTAuthentication

The cookie, then the header - and nobody, rather than a refusal.