Do you know what your options are?
You learned a little bit of how authentication works with Django REST Framework from my short, FREE mini email course. What you might NOT know is that Basic Authentication isn’t the only type of authentication available do you.
You can use the following authentication schemes in Django REST framework and keep checking your inbox for implementation details for each of these authentication schemes.
The list of Authentication types in Django REST Framework
- Basic Authentication — you learned how to implement this while following my free email course. If you haven’t signed up for the email course yet, put your email address in the form at the end of this post.
- Session Authentication — this is similar to the authentication that Django uses to authenticate users.
- Token Authentication — Token Auth is how most APIs authenticate users. You might have played around some APIs that require an “API Key”. This is how you would implement that for your users.
- Custom Authentication — If for some reason, the other authentication schemes don’t do what you want, you can override the BaseAuthentication class and create your own authentication scheme in Django REST Framework.
- OAuth2 Authentication — OAuth authentication is a way to allow your users to authenticate using things like Social Media. I’m sure you’ve logged into certain web apps that allowed you to authenticate using Google or Facebook. This allows you to do that!
Which Authentication scheme is best for me?
That will depend on your specific use case. If you know how to implement each of them, you’ll be better off in the long run. Come back to this post periodically. Each of the authentication schemes above will eventually link to a post that will show you EXACTLY how to implement each one.
If you’d rather not come back for each post, simply put your email in the box below and you’ll get every new post sent directly to your inbox!