Debian Codegraph @

docs/api-guide/authentication.md

raw
1 ---
2 source:
3 - authentication.py
4 ---
5
6 > Auth needs to be pluggable.
7 >
8 > — Jacob Kaplan-Moss, ["REST worst practices"][cite]
9
10 Authentication is the mechanism of associating an incoming request with a set of identifying credentials, such as the user the request came from, or the token that it was signed with. The [permission] and [throttling] policies can then use those credentials to determine if the request should be permitted.
11
12 REST framework provides several authentication schemes out of the box, and also allows you to implement custom schemes.
13
14 Authentication always runs at the very start of the view, before the permission and throttling checks occur, and before any other code is allowed to proceed.
15
16 The `request.user` property will typically be set to an instance of the `contrib.auth` package's `User` class.
17
18 The `request.auth` property is used for any additional authentication information, for example, it may be used to represent an authentication token that the request was signed with.
19
20 !!! note
21 Don't forget that **authentication by itself won't allow or disallow an incoming request**, it simply identifies the credentials that the request was made with.
22
23 For information on how to set up the permission policies for your API please see the [permissions documentation][permission].
24
25 ## How authentication is determined
26
27 The authentication schemes are always defined as a list of classes. REST framework will attempt to authenticate with each class in the list, and will set `request.user` and `request.auth` using the return value of the first class that successfully authenticates.
28
29 If no class authenticates, `request.user` will be set to an instance of `django.contrib.auth.models.AnonymousUser`, and `request.auth` will be set to `None`.
30
31 The value of `request.user` and `request.auth` for unauthenticated requests can be modified using the `UNAUTHENTICATED_USER` and `UNAUTHENTICATED_TOKEN` settings.
32
33 ## Setting the authentication scheme
34
35 The default authentication schemes may be set globally, using the `DEFAULT_AUTHENTICATION_CLASSES` setting. For example.
36
37 REST_FRAMEWORK = {
38 'DEFAULT_AUTHENTICATION_CLASSES': [
39 'rest_framework.authentication.BasicAuthentication',
40 'rest_framework.authentication.SessionAuthentication',
41 ]
42 }
43
44 You can also set the authentication scheme on a per-view or per-viewset basis,
45 using the `APIView` class-based views.
46
47 from rest_framework.authentication import SessionAuthentication, BasicAuthentication
48 from rest_framework.permissions import IsAuthenticated
49 from rest_framework.response import Response
50 from rest_framework.views import APIView
51
52 class ExampleView(APIView):
53 authentication_classes = [SessionAuthentication, BasicAuthentication]
54 permission_classes = [IsAuthenticated]
55
56 def get(self, request, format=None):
57 content = {
58 'user': str(request.user), # `django.contrib.auth.User` instance.
59 'auth': str(request.auth), # None
60 }
61 return Response(content)
62
63 Or, if you're using the `@api_view` decorator with function based views.
64
65 @api_view(['GET'])
66 @authentication_classes([SessionAuthentication, BasicAuthentication])
67 @permission_classes([IsAuthenticated])
68 def example_view(request, format=None):
69 content = {
70 'user': str(request.user), # `django.contrib.auth.User` instance.
71 'auth': str(request.auth), # None
72 }
73 return Response(content)
74
75 ## Unauthorized and Forbidden responses
76
77 When an unauthenticated request is denied permission there are two different error codes that may be appropriate.
78
79 * [HTTP 401 Unauthorized][http401]
80 * [HTTP 403 Permission Denied][http403]
81
82 HTTP 401 responses must always include a `WWW-Authenticate` header, that instructs the client how to authenticate. HTTP 403 responses do not include the `WWW-Authenticate` header.
83
84 The kind of response that will be used depends on the authentication scheme. Although multiple authentication schemes may be in use, only one scheme may be used to determine the type of response. **The first authentication class set on the view is used when determining the type of response**.
85
86 Note that when a request may successfully authenticate, but still be denied permission to perform the request, in which case a `403 Permission Denied` response will always be used, regardless of the authentication scheme.
87
88 ## Django 5.1+ `LoginRequiredMiddleware`
89
90 If you're running Django 5.1+ and use the [`LoginRequiredMiddleware`][login-required-middleware], please note that all views from DRF are opted-out of this middleware. This is because the authentication in DRF is based on authentication and permissions classes, which may be determined after the middleware has been applied. Additionally, when the request is not authenticated, the middleware redirects the user to the login page, which is not suitable for API requests, where it's preferable to return a 401 status code.
91
92 REST framework offers an equivalent mechanism for DRF views via the global settings, `DEFAULT_AUTHENTICATION_CLASSES` and `DEFAULT_PERMISSION_CLASSES`. They should be changed accordingly if you need to enforce that API requests are logged in.
93
94 ## Apache mod_wsgi specific configuration
95
96 Note that if deploying to [Apache using mod_wsgi][mod_wsgi_official], the authorization header is not passed through to a WSGI application by default, as it is assumed that authentication will be handled by Apache, rather than at an application level.
97
98 If you are deploying to Apache, and using any non-session based authentication, you will need to explicitly configure mod_wsgi to pass the required headers through to the application. This can be done by specifying the `WSGIPassAuthorization` directive in the appropriate context and setting it to `'On'`.
99
100 # this can go in either server config, virtual host, directory or .htaccess
101 WSGIPassAuthorization On
102
103 ---
104
105 ## API Reference
106
107 ### BasicAuthentication
108
109 This authentication scheme uses [HTTP Basic Authentication][basicauth], signed against a user's username and password. Basic authentication is generally only appropriate for testing.
110
111 If successfully authenticated, `BasicAuthentication` provides the following credentials.
112
113 * `request.user` will be a Django `User` instance.
114 * `request.auth` will be `None`.
115
116 Unauthenticated responses that are denied permission will result in an `HTTP 401 Unauthorized` response with an appropriate WWW-Authenticate header. For example:
117
118 WWW-Authenticate: Basic realm="api"
119
120 !!! note
121 If you use `BasicAuthentication` in production you must ensure that your API is only available over `https`. You should also ensure that your API clients will always re-request the username and password at login, and will never store those details to persistent storage.
122
123 ### TokenAuthentication
124
125 !!! note
126 The token authentication provided by Django REST framework is a fairly simple implementation.
127
128 For an implementation which allows more than one token per user, has some tighter security implementation details, and supports token expiry, please see the [Django REST Knox][django-rest-knox] third party package.
129
130 This authentication scheme uses a simple token-based HTTP Authentication scheme. Token authentication is appropriate for client-server setups, such as native desktop and mobile clients.
131
132 To use the `TokenAuthentication` scheme you'll need to [configure the authentication classes](#setting-the-authentication-scheme) to include `TokenAuthentication`, and additionally include `rest_framework.authtoken` in your `INSTALLED_APPS` setting:
133
134 INSTALLED_APPS = [
135 ...
136 'rest_framework.authtoken'
137 ]
138
139 Make sure to run `manage.py migrate` after changing your settings.
140
141 The `rest_framework.authtoken` app provides Django database migrations.
142
143 You'll also need to create tokens for your users.
144
145 from rest_framework.authtoken.models import Token
146
147 token = Token.objects.create(user=...)
148 print(token.key)
149
150 For clients to authenticate, the token key should be included in the `Authorization` HTTP header. The key should be prefixed by the string literal "Token", with whitespace separating the two strings. For example:
151
152 Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
153
154 *If you want to use a different keyword in the header, such as `Bearer`, simply subclass `TokenAuthentication` and set the `keyword` class variable.*
155
156 If successfully authenticated, `TokenAuthentication` provides the following credentials.
157
158 * `request.user` will be a Django `User` instance.
159 * `request.auth` will be a `rest_framework.authtoken.models.Token` instance.
160
161 Unauthenticated responses that are denied permission will result in an `HTTP 401 Unauthorized` response with an appropriate WWW-Authenticate header. For example:
162
163 WWW-Authenticate: Token
164
165 The `curl` command line tool may be useful for testing token authenticated APIs. For example:
166
167 curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'
168
169 !!! note
170 If you use `TokenAuthentication` in production you must ensure that your API is only available over `https`.
171
172 #### Generating Tokens
173
174 ##### By using signals
175
176 If you want every user to have an automatically generated Token, you can simply catch the User's `post_save` signal.
177
178 from django.conf import settings
179 from django.db.models.signals import post_save
180 from django.dispatch import receiver
181 from rest_framework.authtoken.models import Token
182
183 @receiver(post_save, sender=settings.AUTH_USER_MODEL)
184 def create_auth_token(sender, instance=None, created=False, **kwargs):
185 if created:
186 Token.objects.create(user=instance)
187
188 Note that you'll want to ensure you place this code snippet in an installed `models.py` module, or some other location that will be imported by Django on startup.
189
190 If you've already created some users, you can generate tokens for all existing users like this:
191
192 from django.contrib.auth.models import User
193 from rest_framework.authtoken.models import Token
194
195 for user in User.objects.all():
196 Token.objects.get_or_create(user=user)
197
198 ##### By exposing an api endpoint
199
200 When using `TokenAuthentication`, you may want to provide a mechanism for clients to obtain a token given the username and password. REST framework provides a built-in view to provide this behavior. To use it, add the `obtain_auth_token` view to your URLconf:
201
202 from rest_framework.authtoken import views
203 urlpatterns += [
204 path('api-token-auth/', views.obtain_auth_token)
205 ]
206
207 Note that the URL part of the pattern can be whatever you want to use.
208
209 The `obtain_auth_token` view will return a JSON response when valid `username` and `password` fields are POSTed to the view using form data or JSON:
210
211 { 'token' : '9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b' }
212
213 Note that the default `obtain_auth_token` view explicitly uses JSON requests and responses, rather than using default renderer and parser classes in your settings.
214
215 By default, there are no permissions or throttling applied to the `obtain_auth_token` view. If you do wish to apply throttling you'll need to override the view class,
216 and include them using the `throttle_classes` attribute.
217
218 If you need a customized version of the `obtain_auth_token` view, you can do so by subclassing the `ObtainAuthToken` view class, and using that in your url conf instead.
219
220 For example, you may return additional user information beyond the `token` value:
221
222 from rest_framework.authtoken.views import ObtainAuthToken
223 from rest_framework.authtoken.models import Token
224 from rest_framework.response import Response
225
226 class CustomAuthToken(ObtainAuthToken):
227
228 def post(self, request, *args, **kwargs):
229 serializer = self.serializer_class(data=request.data,
230 context={'request': request})
231 serializer.is_valid(raise_exception=True)
232 user = serializer.validated_data['user']
233 token, created = Token.objects.get_or_create(user=user)
234 return Response({
235 'token': token.key,
236 'user_id': user.pk,
237 'email': user.email
238 })
239
240 And in your `urls.py`:
241
242 urlpatterns += [
243 path('api-token-auth/', CustomAuthToken.as_view())
244 ]
245
246
247 ##### With Django admin
248
249 It is also possible to create Tokens manually through the admin interface. In case you are using a large user base, we recommend that you monkey patch the `TokenAdmin` class to customize it to your needs, more specifically by declaring the `user` field as `raw_field`.
250
251 `your_app/admin.py`:
252
253 from rest_framework.authtoken.admin import TokenAdmin
254
255 TokenAdmin.raw_id_fields = ['user']
256
257
258 ##### Using Django manage.py command
259
260 Since version 3.6.4 it's possible to generate a user token using the following command:
261
262 ./manage.py drf_create_token <username>
263
264 this command will return the API token for the given user, creating it if it doesn't exist:
265
266 Generated token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b for user user1
267
268 In case you want to regenerate the token (for example if it has been compromised or leaked) you can pass an additional parameter:
269
270 ./manage.py drf_create_token -r <username>
271
272
273 ### SessionAuthentication
274
275 This authentication scheme uses Django's default session backend for authentication. Session authentication is appropriate for AJAX clients that are running in the same session context as your website.
276
277 If successfully authenticated, `SessionAuthentication` provides the following credentials.
278
279 * `request.user` will be a Django `User` instance.
280 * `request.auth` will be `None`.
281
282 Unauthenticated responses that are denied permission will result in an `HTTP 403 Forbidden` response.
283
284 If you're using an AJAX-style API with SessionAuthentication, you'll need to make sure you include a valid CSRF token for any "unsafe" HTTP method calls, such as `PUT`, `PATCH`, `POST` or `DELETE` requests. See the [Django CSRF documentation][csrf-ajax] for more details.
285
286 !!! warning
287 Always use Django's standard login view when creating login pages. This will ensure your login views are properly protected.
288
289 CSRF validation in REST framework works slightly differently from standard Django due to the need to support both session and non-session based authentication to the same views. This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behavior is not suitable for login views, which should always have CSRF validation applied.
290
291
292 ### RemoteUserAuthentication
293
294 This authentication scheme allows you to delegate authentication to your web server, which sets the `REMOTE_USER`
295 environment variable.
296
297 To use it, you must have `django.contrib.auth.backends.RemoteUserBackend` (or a subclass) in your
298 `AUTHENTICATION_BACKENDS` setting. By default, `RemoteUserBackend` creates `User` objects for usernames that don't
299 already exist. To change this and other behavior, consult the
300 [Django documentation](https://docs.djangoproject.com/en/stable/howto/auth-remote-user/).
301
302 If successfully authenticated, `RemoteUserAuthentication` provides the following credentials:
303
304 * `request.user` will be a Django `User` instance.
305 * `request.auth` will be `None`.
306
307 Consult your web server's documentation for information about configuring an authentication method, for example:
308
309 * [Apache Authentication How-To](https://httpd.apache.org/docs/2.4/howto/auth.html)
310 * [NGINX (Restricting Access)](https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/)
311
312
313 ## Custom authentication
314
315 To implement a custom authentication scheme, subclass `BaseAuthentication` and override the `.authenticate(self, request)` method. The method should return a two-tuple of `(user, auth)` if authentication succeeds, or `None` otherwise.
316
317 In some circumstances instead of returning `None`, you may want to raise an `AuthenticationFailed` exception from the `.authenticate()` method.
318
319 Typically the approach you should take is:
320
321 * If authentication is not attempted, return `None`. Any other authentication schemes also in use will still be checked.
322 * If authentication is attempted but fails, raise an `AuthenticationFailed` exception. An error response will be returned immediately, regardless of any permissions checks, and without checking any other authentication schemes.
323
324 You *may* also override the `.authenticate_header(self, request)` method. If implemented, it should return a string that will be used as the value of the `WWW-Authenticate` header in a `HTTP 401 Unauthorized` response.
325
326 If the `.authenticate_header()` method is not overridden, the authentication scheme will return `HTTP 403 Forbidden` responses when an unauthenticated request is denied access.
327
328 !!! note
329 When your custom authenticator is invoked by the request object's `.user` or `.auth` properties, you may see an `AttributeError` re-raised as a `WrappedAttributeError`. This is necessary to prevent the original exception from being suppressed by the outer property access. Python will not recognize that the `AttributeError` originates from your custom authenticator and will instead assume that the request object does not have a `.user` or `.auth` property. These errors should be fixed or otherwise handled by your authenticator.
330
331 ### Example
332
333 The following example will authenticate any incoming request as the user given by the username in a custom request header named 'X-USERNAME'.
334
335 from django.contrib.auth.models import User
336 from rest_framework import authentication
337 from rest_framework import exceptions
338
339 class ExampleAuthentication(authentication.BaseAuthentication):
340 def authenticate(self, request):
341 username = request.META.get('HTTP_X_USERNAME')
342 if not username:
343 return None
344
345 try:
346 user = User.objects.get(username=username)
347 except User.DoesNotExist:
348 raise exceptions.AuthenticationFailed('No such user')
349
350 return (user, None)
351
352 ---
353
354 ## Third party packages
355
356 The following third-party packages are also available.
357
358 ### django-rest-knox
359
360 [Django-rest-knox][django-rest-knox] library provides models and views to handle token-based authentication in a more secure and extensible way than the built-in TokenAuthentication scheme - with Single Page Applications and Mobile clients in mind. It provides per-client tokens, and views to generate them when provided some other authentication (usually basic authentication), to delete the token (providing a server enforced logout) and to delete all tokens (logs out all clients that a user is logged into).
361
362 ### Django OAuth Toolkit
363
364 The [Django OAuth Toolkit][django-oauth-toolkit] package provides OAuth 2.0 support and works with Python 3.4+. The package is maintained by [jazzband][jazzband] and uses the excellent [OAuthLib][oauthlib]. The package is well documented, and well supported and is currently our **recommended package for OAuth 2.0 support**.
365
366 #### Installation & configuration
367
368 Install using `pip`.
369
370 pip install django-oauth-toolkit
371
372 Add the package to your `INSTALLED_APPS` and modify your REST framework settings.
373
374 INSTALLED_APPS = [
375 ...
376 'oauth2_provider',
377 ]
378
379 REST_FRAMEWORK = {
380 'DEFAULT_AUTHENTICATION_CLASSES': [
381 'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
382 ]
383 }
384
385 For more details see the [Django REST framework - Getting started][django-oauth-toolkit-getting-started] documentation.
386
387 ### Django REST framework OAuth
388
389 The [Django REST framework OAuth][django-rest-framework-oauth] package provides both OAuth1 and OAuth2 support for REST framework.
390
391 This package was previously included directly in the REST framework but is now supported and maintained as a third-party package.
392
393 #### Installation & configuration
394
395 Install the package using `pip`.
396
397 pip install djangorestframework-oauth
398
399 For details on configuration and usage see the Django REST framework OAuth documentation for [authentication][django-rest-framework-oauth-authentication] and [permissions][django-rest-framework-oauth-permissions].
400
401 ### JSON Web Token Authentication
402
403 JSON Web Token is a fairly new standard which can be used for token-based authentication. Unlike the built-in TokenAuthentication scheme, JWT Authentication doesn't need to use a database to validate a token. A package for JWT authentication is [djangorestframework-simplejwt][djangorestframework-simplejwt] which provides some features as well as a pluggable token blacklist app.
404
405 ### Hawk HTTP Authentication
406
407 The [HawkREST][hawkrest] library builds on the [Mohawk][mohawk] library to let you work with [Hawk][hawk] signed requests and responses in your API. [Hawk][hawk] lets two parties securely communicate with each other using messages signed by a shared key. It is based on [HTTP MAC access authentication][mac] (which was based on parts of [OAuth 1.0][oauth-1.0a]).
408
409 ### HTTP Signature Authentication
410
411 HTTP Signature (currently a [IETF draft][http-signature-ietf-draft]) provides a way to achieve origin authentication and message integrity for HTTP messages. Similar to [Amazon's HTTP Signature scheme][amazon-http-signature], used by many of its services, it permits stateless, per-request authentication. [Elvio Toccalino][etoccalino] maintains the [djangorestframework-httpsignature][djangorestframework-httpsignature] (outdated) package which provides an easy-to-use HTTP Signature Authentication mechanism. You can use the updated fork version of [djangorestframework-httpsignature][djangorestframework-httpsignature], which is [drf-httpsig][drf-httpsig].
412
413 ### Djoser
414
415 [Djoser][djoser] library provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. The package works with a custom user model and uses token-based authentication. This is a ready to use REST implementation of the Django authentication system.
416
417 ### DRF Auth Kit
418
419 [DRF Auth Kit][drf-auth-kit] library provides a modern REST authentication solution with JWT cookies, social login, multi-factor authentication, and comprehensive user management. The package offers full type safety, automatic OpenAPI schema generation with DRF Spectacular. It supports multiple authentication types (JWT, DRF Token, or Custom) and includes built-in internationalization for 50+ languages.
420
421
422 ### django-rest-auth / dj-rest-auth
423
424 This library provides a set of REST API endpoints for registration, authentication (including social media authentication), password reset, retrieve and update user details, etc. By having these API endpoints, your client apps such as AngularJS, iOS, Android, and others can communicate to your Django backend site independently via REST APIs for user management.
425
426
427 There are currently two forks of this project.
428
429 * [Django-rest-auth][django-rest-auth] is the original project, [but is not currently receiving updates](https://github.com/Tivix/django-rest-auth/issues/568).
430 * [Dj-rest-auth][dj-rest-auth] is a newer fork of the project.
431
432 ### drf-social-oauth2
433
434 [Drf-social-oauth2][drf-social-oauth2] is a framework that helps you authenticate with major social oauth2 vendors, such as Facebook, Google, Twitter, Orcid, etc. It generates tokens in a JWTed way with an easy setup.
435
436 ### drfpasswordless
437
438 [drfpasswordless][drfpasswordless] adds (Medium, Square Cash inspired) passwordless support to Django REST Framework's TokenAuthentication scheme. Users log in and sign up with a token sent to a contact point like an email address or a mobile number.
439
440 ### django-rest-authemail
441
442 [django-rest-authemail][django-rest-authemail] provides a RESTful API interface for user signup and authentication. Email addresses are used for authentication, rather than usernames. API endpoints are available for signup, signup email verification, login, logout, password reset, password reset verification, email change, email change verification, password change, and user detail. A fully functional example project and detailed instructions are included.
443
444 ### Django-Rest-Durin
445
446 [Django-Rest-Durin][django-rest-durin] is built with the idea to have one library that does token auth for multiple Web/CLI/Mobile API clients via one interface but allows different token configuration for each API Client that consumes the API. It provides support for multiple tokens per user via custom models, views, permissions that work with Django-Rest-Framework. The token expiration time can be different per API client and is customizable via the Django Admin Interface.
447
448 More information can be found in the [Documentation](https://django-rest-durin.readthedocs.io/en/latest/index.html).
449
450 ### django-pyoidc
451
452 [django_pyoidc][django-pyoidc] adds support for OpenID Connect (OIDC) authentication. This allows you to delegate user management to an Identity Provider, which can be used to implement Single-Sign-On (SSO). It provides support for most uses-cases, such as customizing how token info are mapped to user models, using OIDC audiences for access control, etc.
453
454 More information can be found in the [Documentation](https://django-pyoidc.readthedocs.io/latest/index.html).
455
456 [cite]: https://jacobian.org/writing/rest-worst-practices/
457 [http401]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2
458 [http403]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4
459 [basicauth]: https://tools.ietf.org/html/rfc2617
460 [permission]: permissions.md
461 [throttling]: throttling.md
462 [csrf-ajax]: https://docs.djangoproject.com/en/stable/howto/csrf/#using-csrf-protection-with-ajax
463 [mod_wsgi_official]: https://modwsgi.readthedocs.io/en/develop/configuration-directives/WSGIPassAuthorization.html
464 [django-oauth-toolkit-getting-started]: https://django-oauth-toolkit.readthedocs.io/en/latest/rest-framework/getting_started.html
465 [django-rest-framework-oauth]: https://jpadilla.github.io/django-rest-framework-oauth/
466 [django-rest-framework-oauth-authentication]: https://jpadilla.github.io/django-rest-framework-oauth/authentication/
467 [django-rest-framework-oauth-permissions]: https://jpadilla.github.io/django-rest-framework-oauth/permissions/
468 [juanriaza]: https://github.com/juanriaza
469 [djangorestframework-digestauth]: https://github.com/juanriaza/django-rest-framework-digestauth
470 [oauth-1.0a]: https://oauth.net/core/1.0a/
471 [django-oauth-toolkit]: https://github.com/evonove/django-oauth-toolkit
472 [jazzband]: https://github.com/jazzband/
473 [oauthlib]: https://github.com/idan/oauthlib
474 [djangorestframework-simplejwt]: https://github.com/davesque/django-rest-framework-simplejwt
475 [etoccalino]: https://github.com/etoccalino/
476 [djangorestframework-httpsignature]: https://github.com/etoccalino/django-rest-framework-httpsignature
477 [drf-httpsig]: https://github.com/ahknight/drf-httpsig
478 [amazon-http-signature]: https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html
479 [http-signature-ietf-draft]: https://datatracker.ietf.org/doc/draft-cavage-http-signatures/
480 [hawkrest]: https://hawkrest.readthedocs.io/en/latest/
481 [hawk]: https://github.com/hueniverse/hawk
482 [mohawk]: https://mohawk.readthedocs.io/en/latest/
483 [mac]: https://tools.ietf.org/html/draft-hammer-oauth-v2-mac-token-05
484 [djoser]: https://github.com/sunscrapers/djoser
485 [django-rest-auth]: https://github.com/Tivix/django-rest-auth
486 [dj-rest-auth]: https://github.com/jazzband/dj-rest-auth
487 [drf-social-oauth2]: https://github.com/wagnerdelima/drf-social-oauth2
488 [django-rest-knox]: https://github.com/James1345/django-rest-knox
489 [drfpasswordless]: https://github.com/aaronn/django-rest-framework-passwordless
490 [django-rest-authemail]: https://github.com/celiao/django-rest-authemail
491 [django-rest-durin]: https://github.com/eshaan7/django-rest-durin
492 [login-required-middleware]: https://docs.djangoproject.com/en/stable/ref/middleware/#django.contrib.auth.middleware.LoginRequiredMiddleware
493 [django-pyoidc]: https://github.com/makinacorpus/django_pyoidc
494 [drf-auth-kit]: https://github.com/huynguyengl99/drf-auth-kit