# Create-daml-app, locally, user not found

**URL:** <https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652>\
**Category:** App Development\
**Created:** [May 31, 2022, 11:27pm UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652 "2022-05-31T23:27:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rikotacards](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@rikotacards](https://forum.canton.network/u/rikotacards)\
**Post date:** [May 31, 2022, 11:27pm UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652/1 "2022-05-31T23:27:19Z")

</div>

Using create-daml-app, sdk 2.2.0  
`daml new create-daml-app --template create-daml-app`

I’m running into the error USER\_NOT\_FOUND, previously we were able to just input into the login textbox any username, and that string would become the party ID. Now, I cannot do that it seems.

From `Setup.daml` it seems that we now have to pre-define the users, is that correct?

```haskell
setup = do
  public <- createPublic
  let aliases = ["Alice", "Bob", "Charlie", "Ron"]
  forA_ aliases $ \alias -> createTestUser $ TestUser alias public

```

Locally, will I always need to predefine some users? I won’t be able to make up some random name on the fly and use the app?

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 1, 2022, 6:11am UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652/2 "2022-06-01T06:11:55Z")

</div>

Yes, users (and parties) have to be allocated upfront. The implicit party allocation feature that existed in SDK \< 2.0 has been removed.

---

<div class="post-metadata">

**Author:** ![a\_putkov](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/a_putkov/32/2971_2.png) [@a\_putkov](https://forum.canton.network/u/a_putkov)\
**Post date:** [June 1, 2022, 5:30pm UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652/3 "2022-06-01T17:30:38Z")

</div>

@cocreature  
I’d like to clarify whether the necessity to allocate parties and users upfront applies to create-daml-app example or to any Daml app compiled with Daml 2.x. My understanding is that for Daml 2.x application it’s perfectly possible to implement client side workflow, where we create users and parties on the fly. I.e. when a user types in the username in the login screen, we check if the user exists, and if not, we allocate a new party and create a new user with the userId that the user typed into the login screen. This workflow could be implemented using [HTTP JSON API](https://docs.daml.com/json-api/) or perhaps even using the [@daml/ledger](https://docs.daml.com/app-dev/bindings-ts/daml-ledger/index.html) Typescript library. Please correct me if I’m wrong.

---

<div class="post-metadata">

**Author:** ![cocreature](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/cocreature/32/36_2.png) [@cocreature](https://forum.canton.network/u/cocreature)\
**Post date:** [June 1, 2022, 5:46pm UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652/4 "2022-06-01T17:46:08Z")

</div>

The ledger-side requirement is the same everywhere: A party needs to be allocated before it is used. Now how you allocate it doesn’t matter as long as it happens before, can be via a Daml script, json api, ….

However, the specific flow you are proposing doesn’t really work: Allocating a party requires admin rights. So if you try to implement your workflow you need to give any user that tries to login admin rights so they can potentially create the party. That’s not really an option in practice.

There is a variant of this that you can make secure: On login, you talk to an IAM. That IAM can have admin rights. Either it hands you a token directly for your user, or if not it checks whatever conditions it needs before creating a party & user and then hands you back a token for that. Clearly more complex to setup though than the create-daml-app model where you just make up the tokens on the fly in your frontend during development.

---

<div class="post-metadata">

**Author:** ![a\_putkov](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/a_putkov/32/2971_2.png) [@a\_putkov](https://forum.canton.network/u/a_putkov)\
**Post date:** [June 1, 2022, 6:03pm UTC](https://forum.canton.network/t/create-daml-app-locally-user-not-found/4652/5 "2022-06-01T18:03:57Z")

</div>

Thank you very much @cocreature. This is very good to know.
