# my request.user is always AnonymousUser

**URL:** <https://forum.djangoproject.com/t/my-request-user-is-always-anonymoususer/23581>\
**Category:** Forms & APIs\
**Created:** [September 2, 2023, 1:26am UTC](https://forum.djangoproject.com/t/my-request-user-is-always-anonymoususer/23581 "2023-09-02T01:26:53Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![antoinehumbert](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/antoinehumbert/32/14851_2.png) [@antoinehumbert](https://forum.djangoproject.com/u/antoinehumbert)\
**Post date:** [September 2, 2023, 6:56am UTC](https://forum.djangoproject.com/t/my-request-user-is-always-anonymoususer/23581/5 "2023-09-02T06:56:34Z")

</div>

Hi.

If your vue3 code is not served by the same domain as your django API (i.e. localhost:8000), you may be facing a cross domain issue.

If so, to ensure session cookie is sent in subsequent requests after login, you need to set `withCredentials` attribute to `true` in the request. E.g.

`axios.post('http://localhost:8000/settings/getinfo/', { withCredentials: true })`

You may also enforce this behaviour for every request by setting  
`axios.defaults.withCredentials`

You’ll also have to correcty set CORS settings on django side (see [Be logged in mutiple sites - #13 by antoinehumbert](https://forum.djangoproject.com/t/be-logged-in-mutiple-sites/22501/13))

But, as stated by Ken, checking requests/responses headers from your browser should help in identifying the root cause of the problem

---

_[View the full topic](https://forum.djangoproject.com/t/my-request-user-is-always-anonymoususer/23581)._
