Everybody Struggles

During week two (December 8 to 14) of my internship at the GNOME foundation, my main task was to research on the Django “API” authentication methods and implement a mode of Authentication, that will provide a secret random string, instead of the usual user-password mode to authenticate users, who had to gain access to the write APIs I was going to develop. My mentor recommended I go the Api key way, so I went on to do my work.

The first issue was picking the right Django app/package to use from the bunch of packages I found:

Django Packages

Just to name a few

Luckily I stumbled on the Django packages grid which clearly outlined the features of each package. It became crystal clear that the Django rest framework was the real deal.

The next challenge was the Auth section of the Django Rest Framework documentation didn’t speak the Api Key language, but rather the Token-based Auth language. As a beginner, this was quite confusing and I kept wondering what the difference between these two was.

I did some extensive research and here’s what I found…

API Keys

Token-based Authentication

Reading these conflicting write-ups confused me further and I wasn’t exactly sure which one was right for my use case. What I was sure about was that I needed to authenticate users before they could gain access to the write APIs

I reached out to a few people and got some very good clarifications. It became clear that Token-based Authentication was the way to go because it met my requirements and was better supported by the Django rest framework.

Lessons Learnt

Let me know what you think about the Api Key Vs Token Auth Struggle…