Two principalIds for the same frontend

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?

1 Like

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

2 Likes

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

1 Like