昨日に引き続き、Postmanでpost, get の動作確認をしながら、Authenticationの動きを観察。


トークンの設定をして、一旦、「python3 manage.py flush」でデータベースのデータを消去。


python3 manage.py migrate でマイグレートしておく。

python3 manage.py createsuperuser で再度admin管理者作成

Token を作成し、再度 Postman で Send してみると、無時に中身が表示できた

ユーザにトークンを渡す
(urls.py)from rest_framework.authtoken.views import obtain_auth_token
Django Restframework Authentication 参照

メンテナンス終了しているが、比較的簡単に導入できるということなので、django-rest-authで試してみた

api token でも django-rest-auth でも同じトークンが返されていることが確認できる。
API endpointsのマニュアルはこちらパスワード再設定や変更も同じ要領で実装できる