پرش به محتویات

احراز هویت

سه کلاس احراز هویت DRF: کوکی، هدر، و هر کدام بدون رد کردن.

از خود کد خوانده می‌شود، پس هیچ‌وقت از آن عقب نمی‌ماند. توضیح‌ها مال خود کد هستند، به انگلیسی.

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.