Skip to content

Commit

Permalink
Merge pull request #284 from jenslauterbach/add-token-auth
Browse files Browse the repository at this point in the history
Enable Token Authentication for API
  • Loading branch information
jandd committed Jan 9, 2022
2 parents 098a4f7 + 351b8af commit a827c92
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions devday/devday/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ def split_list(value: str):
"django.contrib.staticfiles",
"django.contrib.messages",
"rest_framework",
"rest_framework.authtoken",
"devday.apps.DevDayApp",
"event.apps.EventsConfig",
"attendee.apps.AttendeeConfig",
Expand Down Expand Up @@ -240,6 +241,7 @@ def split_list(value: str):
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.BasicAuthentication",
"rest_framework.authentication.SessionAuthentication",
"rest_framework.authentication.TokenAuthentication",
],
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.IsAuthenticated"],
}
Expand Down
2 changes: 2 additions & 0 deletions devday/devday/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from devday.views import SendEmailView, exception_test_view
from rest_framework import routers
from rest_framework.authtoken import views

from event.api_views import EventDetailViewSet
from speaker.api_views import SpeakerViewSet
Expand All @@ -25,6 +26,7 @@
urlpatterns = [
url(r"^api/", include(router.urls)),
url(r"^api-auth/", include("rest_framework.urls")),
url(r"^api-token-auth/", views.obtain_auth_token),
url(r"^admin/", admin.site.urls),
url(r"^admin/send_email/$", SendEmailView.as_view(), name="send_email"),
url(r"^sitemap\.xml$", sitemap_view, {"sitemaps": {"cmspages": CMSSitemap}}),
Expand Down

0 comments on commit a827c92

Please sign in to comment.