# Authentication is lost after page refresh even with custom domain

**URL:** <https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448>\
**Category:** Get Help\
**Tags:** sdks-quickstarts, auth0-angular\
**Created:** [June 16, 2024, 9:36am UTC](https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448 "2024-06-16T09:36:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maiksfd](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@maiksfd](https://community.auth0.com/u/maiksfd)\
**Post date:** [June 16, 2024, 9:36am UTC](https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448/1 "2024-06-16T09:36:48Z")

</div>

Hey,

i recently started using Auth0 for my new project with Angular. As many others i stumbled over the refesh problem and found this FAQ: [Why is authentication lost after refreshing my single page application?](https://community.auth0.com/t/why-is-authentication-lost-after-refreshing-my-single-page-application/56276)

In there using a custom domain is stated as a solution. However i still get this problem in some Browsers (e.g. Firefox). So even if im using a custom domain, the authentification is lost after a refresh.

Is this because im on localhost (atm for development) and my custom domain is something else ([auth.DOMAIN.com](http://auth.DOMAIN.com)) so this would go away in production? I would love to not be forced to use the local storage.

Best regards.

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [June 17, 2024, 8:56am UTC](https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448/3 "2024-06-17T08:56:18Z")

</div>

Hi there @maiksfd ,

Does the problem happen only when you test your auth flow in a browser under restricted third-party cookies?

If yes, then

> [@maiksfd](#):
>
> Is this because im on localhost (atm for development) and my custom domain is something else ([auth.DOMAIN.com](http://auth.DOMAIN.com)) so this would go away in production?

would be correct.

For the time being, when you’re developing on localhost, you can consider creating a new alias for your machine under `/etc/hosts` by mapping it to your custom domain like this:

`127.0.0.1 domain`.

This change implies that you have to:

1. Run your application now by calling `http://domain:port`;
2. In your application codebase, find and replace “localhost” with a new alias;
3. In your Auth0 tenant → Applications → this app → Settings: replace “localhost” with a new alias where relevant.

Does this help? 🙂

---

<div class="post-metadata">

**Author:** ![maiksfd](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@maiksfd](https://community.auth0.com/u/maiksfd)\
**Post date:** [June 17, 2024, 5:56pm UTC](https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448/6 "2024-06-17T17:56:24Z")

</div>

Hey @marcelina.barycka,

thank you for the quick response.

I found the exact option in the firefox settings (block cookies for cross-page activity tracking) that causes the problem.

For now i added the alias for my machine and it works like a charm.

Thank you very much 🙂

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 1, 2024, 5:56pm UTC](https://community.auth0.com/t/authentication-is-lost-after-page-refresh-even-with-custom-domain/136448/7 "2024-07-01T17:56:35Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
