# Two principalIds for the same frontend

**URL:** <https://forum.dfinity.org/t/two-principalids-for-the-same-frontend/40187>\
**Category:** internet-identity\
**Created:** [January 17, 2025, 6:20am UTC](https://forum.dfinity.org/t/two-principalids-for-the-same-frontend/40187 "2025-01-17T06:20:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [January 17, 2025, 6:20am UTC](https://forum.dfinity.org/t/two-principalids-for-the-same-frontend/40187/1 "2025-01-17T06:20:48Z")

</div>

What is the best approach to handle the following situation?

When a user logs into an application for the first time, a user profile is created and identified by the caller’s principalId.

Later, the same user logs in to the application using a custom domain that points to the same frontend canister. However, in this scenario, the caller’s principalId changes, resulting in the creation of a new user profile.

As a result, the user ends up with two separate profiles: one associated with the native canister ID domain and another with the custom domain.

How can this situation be effectively managed to ensure that the user maintains a single unified profile regardless of the domain they log in from? What is the best approach to handle the following situation?

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [January 17, 2025, 7:35am UTC](https://forum.dfinity.org/t/two-principalids-for-the-same-frontend/40187/2 "2025-01-17T07:35:29Z")

</div>

Use Juno, which automates the process, or set up an alternative frontend origin.

> **[Alternative frontend origins | Internet Computer](https://internetcomputer.org/docs/current/developer-docs/identity/internet-identity/alternative-origins/)**
>
> If your application has reached the stage where you want to change domain names, and you have been authenticating with Internet Identity (II), you will want to make sure that your users can seamlessly keep the same principals they have already been...

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [January 17, 2025, 8:42am UTC](https://forum.dfinity.org/t/two-principalids-for-the-same-frontend/40187/3 "2025-01-17T08:42:14Z")

</div>

Ah, thank you very much, I’ll add this alternativeOrigins.
