# Sharing IdTokenJWT in P2P mode could allow impersonation, no? 

**URL:** <https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312>\
**Category:** Multiplayer\
**Tags:** epic-online-services, question\
**Created:** [May 30, 2025, 9:54am UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312 "2025-05-30T09:54:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [May 30, 2025, 9:54am UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312/1 "2025-05-30T09:54:48Z")

</div>

Hi,

I was looking at the Anti-Cheat sample, more precisely at the P2P implementation, and it seems that one user sends their ProductUserId & IdTokenJWT to other user. The second user verifies it, using EOS\_Connect\_VerifyIdToken.

Wouldn’t that allow the user receiving this information to impersonate the user sending it? At least, from the content of the token, I don’t think anything would prevent that.

It seems that the better implementation would have to have a trusted service to check this value and confirm to the peer the validity. It’s a bit trickier to implement, especially in a sample, but if my previous understanding is correct, I think the current example is not good to follow.

Cheers

---

<div class="post-metadata">

**Author:** ![SebBergy2.0](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sebbergy2.0/32/1214708_2.png) [@SebBergy2.0](https://forums.unrealengine.com/u/SebBergy2.0)\
**Post date:** [June 2, 2025, 4:07pm UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312/2 "2025-06-02T16:07:15Z")

</div>

Hello, CopyIdToken returns an ID token, not an access token. [Here’s](https://oauth.net/id-tokens-vs-access-tokens/) a good comparison between ID and access tokens.

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 6, 2025, 11:02am UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312/3 "2025-06-06T11:02:59Z")

</div>

I don’t know if it would matter though.

Wouldn’t it be possible to have the following.

1. Player 1 host a P2P game, receive the ProductUserId & IdTokenJWT from Player 2.
2. Player 1 leaves and joins the game of Player 3, sending the ProductUserId & IdTokenJWT of Player 2.
3. Wouldn’t the Player 3 successfully verify the login data and believe Player 1 is Player 2?

---

<div class="post-metadata">

**Author:** ![SebBergy2.0](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sebbergy2.0/32/1214708_2.png) [@SebBergy2.0](https://forums.unrealengine.com/u/SebBergy2.0)\
**Post date:** [June 6, 2025, 1:10pm UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312/4 "2025-06-06T13:10:19Z")

</div>

In this case, Player1 would get kicked from the protected session, assuming anti-cheat is implemented correctly. The reason is that peer-to-peer messaging wouldn’t be working correctly. For a player to remain in a session, they must send messages to one another, triggered by notifications from our backend. The messaging flow is explained [here](https://dev.epicgames.com/docs/game-services/anti-cheat/using-anti-cheat#peer-to-peer-mode).

---

<div class="post-metadata">

**Author:** ![anonymous-edc](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous-edc](https://forums.unrealengine.com/u/anonymous-edc)\
**Post date:** [June 6, 2025, 1:18pm UTC](https://forums.unrealengine.com/t/sharing-idtokenjwt-in-p2p-mode-could-allow-impersonation-no/2858312/5 "2025-06-06T13:18:30Z")

</div>

Ok, make sense.

Thanks a lot for the answers.
