Reputation: 210
so i have a project that i created with vuejs and django, for authentication i did it with session authentification. so when it connects it launches vue js project but i wanted to know can i do it when it won't be authentify like do i create a new vuejs project or i can use the old one. or tell me if you have a other proposition . ps: i know that there are Jwt Authentification]
#python url to lunch vuejs
re_path(r"^(?!media/).*$", IndexTemplateView.as_view(), name="entry-point"),
the view :
class IndexTemplateView(LoginRequiredMixin, TemplateView):
def get_template_names(self):
if not settings.DEBUG:
template_name = "index.html"
else:
template_name = "index-dev.html"
return template_name
Upvotes: 2
Views: 115
Reputation: 83
Don't use SessionAuthentication
From django-rest-framework's official docs SessionAuthentication is appropriate for AJAX clients that are running in the same session context as your website.
Use TokenAuthentication
Consider using TokenAuthentication which is appropriate for client-server setups, your vue.js app being the client
Upvotes: 1