How do users get a token to read as the public party on project:DABL

I have some public data that I would like to display in my app. It all works through the DABL console, but when my users log into DABL using the signup flow from create-daml-app, they only get a token for their user party, not for the public party of the ledger. How can my app get a token for both their user and the public party?


We use the dabl-react (GitHub - digital-asset/dabl-react: DABLified react bindings) library’s PublicLedger context, which allows you to run queries as the Public party with useQueryStreamAsPublic().


Hi @bernhard.

Although it is in principle possible to create a ledger JWT that allows its bearer to act as authenticated parties, DABL currently does not. When users authenticate to DABL applications (in other words not through the console), they are provided with a JWT that allows them to act only as themselves. Also, for each ledger, there exists an endpoint which anybody (including people that have not authenticated) can request and receive a JWT that designates the per-ledger public party. The supported approach for distributing an access token for public use to a DABL application user is to supply them with frontend code that causes their browser to request a token specifically for public use.

For more info, kindly see our docs on this subject:
Also, a reference implementation may prove useful: dablchat/ChatManager.js at 8062bf07f35296dad725a62b6b9a481e0cbfc261 · digital-asset/dablchat · GitHub
Finally, it looks like some more re-usable React abstractions have been built specifically for this purpose, as noted by @alex.graham


Hi alex, Which token should I set as the Bearer token in my request when I want to invoke the endpoint described here :


Hi @Albert_Pul, you shouldn’t need to send any authentication with a request to the public token endpoint.

1 Like