# Issue with Anonymous principal

**URL:** <https://forum.dfinity.org/t/issue-with-anonymous-principal/30757>\
**Category:** Developers\
**Created:** [May 14, 2024, 2:58pm UTC](https://forum.dfinity.org/t/issue-with-anonymous-principal/30757 "2024-05-14T14:58:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![b3hr4d](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/b3hr4d/32/9755_2.png) [@b3hr4d](https://forum.dfinity.org/u/b3hr4d)\
**Post date:** [May 14, 2024, 3:15pm UTC](https://forum.dfinity.org/t/issue-with-anonymous-principal/30757/2 "2024-05-14T15:15:56Z")

</div>

This is not how you can create agent with identity!

```javascript
const agent = new HttpAgent({ _principal });

```

You need to set agent like this

```javascript
const agent = new HttpAgent({ identity })

```

I highly recommend you to take a look at the [@ic-reactor/react](https://forum.dfinity.org/t/introduction-ic-reactor-react-for-react-developers/27930)

---

_[View the full topic](https://forum.dfinity.org/t/issue-with-anonymous-principal/30757)._
