# Token generation on a front end with template from "daml new create-daml-app --template create-daml-app"

**URL:** <https://forum.canton.network/t/token-generation-on-a-front-end-with-template-from-daml-new-create-daml-app-template-create-daml-app/5629>\
**Category:** App Development\
**Tags:** react-ui, frontend, react\
**Created:** [November 9, 2022, 3:38pm UTC](https://forum.canton.network/t/token-generation-on-a-front-end-with-template-from-daml-new-create-daml-app-template-create-daml-app/5629 "2022-11-09T15:38:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joao\_Freitas](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/joao_freitas/32/3352_2.png) [@Joao\_Freitas](https://forum.canton.network/u/Joao_Freitas)\
**Post date:** [November 9, 2022, 3:38pm UTC](https://forum.canton.network/t/token-generation-on-a-front-end-with-template-from-daml-new-create-daml-app-template-create-daml-app/5629/1 "2022-11-09T15:38:08Z")

</div>

Hi 🙂

I am trying to understand if it´s possible to generate locally a custom token on a project that I´ve bootstraped with the command:

`daml new create-daml-app --template create-daml-app`.

Since the SDK version being used on the project is SDK \>= 2.0.0, the template code will use the following format for the token payload:

```haskell
{
  "sub": "alice",
  "scope": "daml_ledger_api"
}

```

How can i setup the readAs and actAs like on the example under through the Front End?

```haskell
{
  "exp": 1669008104.608,
  "https://daml.com/ledger-api": {
    "ledgerId": "gambyl-sandbox",
    "applicationId": "da-marketplace",
    "actAs": [
      "Alice"
    ],
    "readAs": [
      "Alice",
      "Public"
    ]
  },
  "party": "Alice",
  "ledgerId": "gambyl-sandbox",
  "partyName": "Alice"
}

```

Thank you in advance 🙂

---

<div class="post-metadata">

**Author:** ![stefanobaghino-da](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/stefanobaghino-da/32/7057_2.png) [@stefanobaghino-da](https://forum.canton.network/u/stefanobaghino-da)\
**Post date:** [November 10, 2022, 6:47am UTC](https://forum.canton.network/t/token-generation-on-a-front-end-with-template-from-daml-new-create-daml-app-template-create-daml-app/5629/2 "2022-11-10T06:47:17Z")

</div>

Hi @Joao_Freitas, from Daml 2.0 we have a new concept of _user_ managed by the `UserManagementService`. Instead of providing claims in the token itself, you map the off-ledger concept of user (which is the `sub` field in the audience-based or scope-based tokens) to its on-ledger role as a party.

You can read more about tokens in the [page about authorization in our documentation](https://docs.daml.com/app-dev/authorization.html).

As for how to access the `UserManagementService`, you can do so both through the [Ledger API](https://docs.daml.com/app-dev/grpc/proto-docs.html#com-daml-ledger-api-v1-admin-user-management-service-proto) (e.g. using the [Java bindings](https://docs.daml.com/app-dev/bindings-java/index.html)) or using the [HTTP JSON API off-ledger integration](https://docs.daml.com/json-api/index.html#create-a-new-user).
