Momentum logo
Team 14 Classroom

๐Ÿป Token Authentication and CORS ๐Ÿป

Posted on Sep 19th, 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 authenticated 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