# Best practice for storing tokens?

**URL:** <https://forum.djangoproject.com/t/best-practice-for-storing-tokens/5871>\
**Category:** Using Django\
**Created:** [December 27, 2020, 1:39pm UTC](https://forum.djangoproject.com/t/best-practice-for-storing-tokens/5871 "2020-12-27T13:39:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![clarkeustaquio](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/clarkeustaquio/32/6132_2.png) [@clarkeustaquio](https://forum.djangoproject.com/u/clarkeustaquio)\
**Post date:** [December 27, 2020, 1:39pm UTC](https://forum.djangoproject.com/t/best-practice-for-storing-tokens/5871/1 "2020-12-27T13:39:05Z")

</div>

Hi I am using django rest framework authentication to generate user token

```auto
from rest_framework.authtoken import views
urlpatterns += [
    path('api-token-auth/', views.obtain_auth_token)
]

```

And will use this token on front-end react, what do you guys think the best way to  
store the token on client side for login?

Is it safe to use the localStorage or sessionStorage? And if there is anything else that is much better, please tell me. Thank you
