How to obtain User Grant Access Token using DAML Hub site credentials?

I am unable to get the User Grant Access Token using the DAML Hub account Site Credentials.

This was the link to the daml docs: Daml Hub docs | Console Overview

Would be great if anyone can help me here! Thanks in advance.

Hi,

May I ask what it is you’re trying to achieve?
User grants isn’t a stable API we promise to keep supporting.

That being said, the endpoint to obtain a User grant token for a ledger is:
curl -XPOST https://login.hub.daml.com/auth/ledger/{ledgerId}/user_grants -H "Authorization: Bearer <Account-Token>"
you can get the account token from the Account Settings page, or using Site Credentials.

Hi @Sammy_Abed

Thank you for the quick reply.

I am trying to handle the user creation from the server end ( [Non-manual method for creating parties on DAML hub).

Your solution works with the account JWT, but would you mind sharing how the I can obtain the Bearer Account JWT using site credentials?

Cheers!

Hi @Kushan_Delgoda

You can get a Site Credential from the Account Settings Page: https://hub.daml.com/console/account/credentials

Then you make a request exactly as described on our docs here, which will give an Account Token that’s valid for 1 day.

Cheers