I am writing a Single Page Application (SPA) in react and want to use Django as the backend. I read this post and this and I am convinced that I need to use token based authentication instead of session based.
So here is what I want to accomplish:
- users enters username & password, my app send these via ajax to Django for verification
- assuming the username & password are valid, Django returns an access token to the SPA
- the SPA can start using this token to request REST apis
I found the Django OAuth Toolkit and this page seems to show how to accomplish what I have just mentioned.
As I am new to OAuth2 and token based authentication, I am not sure if my assertion is correct. (I didn't quite get the part about register your application)
I hope someone with more experiences can help me out. Thanks!
P.S. If I don't need token rotation, I guess I can just go with the TokenAuthentication provided by DRF right?