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

**URL:** <https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097>\
**Category:** App Development\
**Tags:** damlhub\
**Created:** [February 11, 2023, 4:28pm UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097 "2023-02-11T16:28:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kushan\_Delgoda](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/kushan_delgoda/32/5857_2.png) [@Kushan\_Delgoda](https://forum.canton.network/u/Kushan_Delgoda)\
**Post date:** [February 11, 2023, 4:28pm UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097/1 "2023-02-11T16:28:19Z")

</div>

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](https://hub.daml.com/docs/quickstart/#site-credentials)

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

---

<div class="post-metadata">

**Author:** ![Sammy\_Abed](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sammy_abed/32/4071_2.png) [@Sammy\_Abed](https://forum.canton.network/u/Sammy_Abed)\
**Post date:** [February 11, 2023, 5:01pm UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097/2 "2023-02-11T17:01:29Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![Sammy\_Abed](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sammy_abed/32/4071_2.png) [@Sammy\_Abed](https://forum.canton.network/u/Sammy_Abed)\
**Post date:** [February 11, 2023, 5:35pm UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097/3 "2023-02-11T17:35:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kushan\_Delgoda](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/kushan_delgoda/32/5857_2.png) [@Kushan\_Delgoda](https://forum.canton.network/u/Kushan_Delgoda)\
**Post date:** [February 12, 2023, 3:21pm UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097/4 "2023-02-12T15:21:28Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Sammy\_Abed](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/sammy_abed/32/4071_2.png) [@Sammy\_Abed](https://forum.canton.network/u/Sammy_Abed)\
**Post date:** [February 13, 2023, 12:35am UTC](https://forum.canton.network/t/how-to-obtain-user-grant-access-token-using-daml-hub-site-credentials/6097/5 "2023-02-13T00:35:03Z")

</div>

Hi @Kushan_Delgoda

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

Then you make a request exactly as described on [our docs here](https://hub.daml.com/docs/quickstart/?_ga=2.117815886.633258624.1676246255-1323517689.1662413960&_gl=1*1q1w0tx*_ga*MTMyMzUxNzY4OS4xNjYyNDEzOTYw*_ga_GVK9ZHZSMR*MTY3NjI0NjI1NS4yNi4xLjE2NzYyNDgzOTMuMC4wLjA.#site-credentials), which will give an Account Token that’s valid for 1 day.

Cheers
