# Why principal ID is different for same identity for nns wallet and my own canister?

**URL:** <https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740>\
**Category:** Developers\
**Created:** [May 14, 2024, 10:02am UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740 "2024-05-14T10:02:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oleksiivinogradov](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/oleksiivinogradov/32/16035_2.png) [@oleksiivinogradov](https://forum.dfinity.org/u/oleksiivinogradov)\
**Post date:** [May 14, 2024, 10:02am UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/1 "2024-05-14T10:02:49Z")

</div>

I expect to see same principal to avoid change UI and provide user principal ID to add ICP balance.

Inside my code, I grab principal like that:  
const canisterIdinternetIdentity = ‘rdmx6-jaaaa-aaaaa-aaadq-cai’

```
    window.ICPauthClient.login({

        identityProvider: (window.web3ChainId) == 111111456327830 ? "https://identity.ic0.app/#authorize" :'http://' + canisterIdinternetIdentity + '.localhost:4943',
        // 7 days in nanoseconds
        maxTimeToLive: BigInt(7 * 24 * 60 * 60 * 1000 * 1000 * 1000),

        onSuccess: async () => {
            console.log("success")

            const identity = await window.ICPauthClient.getIdentity();
            console.log("identity " + JSON.stringify(identity))

            const principal = await identity.getPrincipal()
            console.log("getPrincipal " + principal)

```

---

<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:** [May 14, 2024, 10:53am UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/2 "2024-05-14T10:53:41Z")

</div>

> Why principal ID is different for same identity for nns wallet and my own canister?

Long story short, principals authenticated with Internet Identity are closely tied to the domain of authentication.

In other words and for example, if you sign in on `hello.com`, `www.hello.com`, `yolo.com`, and `localhost:5173`, you will get four different principals for the same identity.

This is designed to prevent tracking and preserve anonymity.

---

<div class="post-metadata">

**Author:** ![oleksiivinogradov](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/oleksiivinogradov/32/16035_2.png) [@oleksiivinogradov](https://forum.dfinity.org/u/oleksiivinogradov)\
**Post date:** [May 15, 2024, 10:49am UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/3 "2024-05-15T10:49:53Z")

</div>

general problem in case that I must add special UI for receive/send ICP for my own local wallet, which is not good user experience. If there any ways solve it for user friendly manner?

---

<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:** [May 15, 2024, 12:25pm UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/4 "2024-05-15T12:25:07Z")

</div>

Your question is a bit vague, so I’m not entirely sure what you’re aiming to achieve. Different principles don’t necessarily lead to an unfriendly user experience, in my opinion. Could you provide more context and perhaps some code?

But generally speaking, what I described above is a fact. There are some signer standards that are currently being discussed and implemented (see [repo](https://github.com/dfinity/wg-identity-authentication/)) which would ultimately standardize communication with wallets, but they are not ready for production yet.

If it’s the wallet interaction that bothers you, you might want to look at [Plug](https://plugwallet.ooo/) or other wallets for now, but again, I’m really not sure about your context.

---

<div class="post-metadata">

**Author:** ![oleksiivinogradov](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/oleksiivinogradov/32/16035_2.png) [@oleksiivinogradov](https://forum.dfinity.org/u/oleksiivinogradov)\
**Post date:** [May 15, 2024, 12:34pm UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/5 "2024-05-15T12:34:27Z")

</div>

> [@peterparker](#):
>
> Different principles don’t necessarily lead to an unfriendly user experience, in my opinion

In general, users expect to have wallet on [nis](https://nns.ic0.app/) with balance and when they connect to my game, same wallet expected with same balance. This is how regular experience works  
In case of have different addresses and balances for different games users must take care send balance before start, my UI must handle send money back e.t.c.

---

<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:** [May 15, 2024, 1:08pm UTC](https://forum.dfinity.org/t/why-principal-id-is-different-for-same-identity-for-nns-wallet-and-my-own-canister/30740/6 "2024-05-15T13:08:54Z")

</div>

Thanks for the context. Then my last answer was correct. I think NNS-dapp does not support yet the pattern you are describing because the standards are not yet accepted. Don’t know if it will in the future but, for sure when standards exist, then multiple wallets can coexist while you implement only one standard in your app.

Meanwhile, as I also pointed out in my previous message, if you are interested to implement such an experience now, you can have a look to existing wallets which, I guess, implement their own interaction scheme such as Plug and other existing wallets. See for example this [list](https://github.com/dfinity/awesome-internet-computer?tab=readme-ov-file#wallets-and-authentication).

Hope that helps.
