Momentum logo
Team 13 Classroom

🐻 Token Authentication and CORS 🐻

Posted on Jul 25th, 2022

Today’s Topics

  • Token authentication in DRF with Djoser
  • CORS headers

🎯 Collaborative Project

Work with your team. Tonight, plan out your models – please draw a diagram! – and write down a list of the endpoints you think you will need. It should take you some time to talk this through. What data will those endpoints have to return? Will your endpoints need to accept any data (remember you can do this in the body of the request or using part of the URL)?

Your list of planned endpoints should look something like (this is a partial list using examples from Habit Tracker. You’re going to need a bunch more endpoints than this). Keep in mind that you should include endpoints ONLY if you need them, so consider the actions that you need to support according to the project requirements.

Example planning for endpoints (you’ll need more than these, of course):

Request URL   Description
GET api/habits   returns a list of all habits for the logged in user
GET api/habits/<int:pk>   returns details about one habit and its associated records
POST api/habits   create a new habit

No writing code yet! Today should be used for planning only. We’ll cover working together on GitHub tomorrow.

📖 Read | 📺 Watch | 🎧 Listen

🔖 Resources

Authentication

CORS

Permissions

Back to home