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

Hi :slight_smile:

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:

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

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

{
  "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 :slight_smile:

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.

As for how to access the UserManagementService, you can do so both through the Ledger API (e.g. using the Java bindings) or using the HTTP JSON API off-ledger integration.