Register, Login, and Logout users in Django Rest Framework

Moeedlodhi
Geek Culture
Published in
6 min readMay 23, 2021

--

Time to share my experience with DRF

Photo by inlytics | LinkedIn Analytics Tool on Unsplash

A new Project, A new Learning experience. Most recently, I worked on a freelance project which happened to be my first professional experience working with the Django REST Framework.

The Experience was a steep learning curve which sometimes seemed to be a bit overwhelming but as with anything else in life. If you persist, you get through it.

In this article, I will go over the theory of Token Authentication and how to Register and Log in users using Token Authentication in DRF as well as how to log users out. So without further wait, Let’s begin.

What is Token Authentication?

When a user comes to a website, they want to use the site's features. They want to rome around, access content and if it’s a Social application, interact with other users.

The thing is, The website doesn’t know “who” the user is. When a user does log in, The user themselves know they logged in and are “inside” the website but the server doesn’t know.

The only way for the server to know who the user is when The front end of the website will send a “Token” with every request to the backend.
This “Token” is used by the backend to authenticate a user and authorize them…

--

--