# Running ddit integration outside of daml hub

**URL:** <https://forum.canton.network/t/running-ddit-integration-outside-of-daml-hub/4976>\
**Category:** App Development\
**Tags:** dazl, damlhub\
**Created:** [July 26, 2022, 9:54am UTC](https://forum.canton.network/t/running-ddit-integration-outside-of-daml-hub/4976 "2022-07-26T09:54:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [July 26, 2022, 9:54am UTC](https://forum.canton.network/t/running-ddit-integration-outside-of-daml-hub/4976/1 "2022-07-26T09:54:08Z")

</div>

Hello all,

I’m working on project where my team have built an integration built in python using the ddit package with the intention of being deployed in daml hub. However it is not possible at the time to have the integration running there, due to external factors. As such we’re experimenting in running the integration external to daml hub, but we are getting a connection issue:

```haskell
today at 09:36:312022-07-26T08:36:31+0000 [INFO] (dazl) Establishing a connection to https://foobar.daml.app:443 on party ledger-party-abc...
today at 09:38:312022-07-26T08:38:31+0000 [INFO] (dazl) Closing a GRPCv1Connection channel...
today at 09:38:312022-07-26T08:38:31+0000 [ERROR] (daml-dit-if) The main dazl coroutine died with an exception
today at 09:38:31Traceback (most recent call last):
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/daml_dit_if/main/main.py", line 65, in run_dazl_network
today at 09:38:31 await network.aio_run()
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/client/api.py", line 404, in aio_run
today at 09:38:31 await self._impl.aio_run(*coroutines)
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/client/_network_client_impl.py", line 198, in aio_run
today at 09:38:31 await runner.run()
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/client/_network_client_impl.py", line 485, in run
today at 09:38:31 await self._init(
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/client/_network_client_impl.py", line 564, in _init
today at 09:38:31 await gather(*(party_impl.connect_in(self.pool) for party_impl in party_impls))
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/protocols/autodetect.py", line 69, in connect
today at 09:38:31 ledger = await self.ledger()
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/protocols/autodetect.py", line 45, in ledger
today at 09:38:31 return await self._ledger_future
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/protocols/autodetect.py", line 182, in _main
today at 09:38:31 for i, metadata in enumerate(_monitor_ledger_network(conn)):
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/protocols/autodetect.py", line 219, in _monitor_ledger_network
today at 09:38:31 ledger_id = grpc_detect_ledger_id(connection)
today at 09:38:31 File "/home/daml/foobar-integration/.ddit-venv/lib/python3.8/site-packages/dazl/protocols/v1/grpc.py", line 249, in grpc_detect_ledger_id
today at 09:38:31 raise ConnectionTimeoutError(
today at 09:38:31dazl.protocols.errors.ConnectionTimeoutError: connection timeout exceeded: 120.0 seconds
today at 09:38:312022-07-26T08:38:31+0000 [ERROR] (daml-dit-if) === FATAL ERROR: Execution cannot continue without dazl coroutine. ===

```

On looking for similar questions here on discuss, what we found was only using [Dazl](https://discuss.daml.com/t/error-connecting-to-daml-hub-with-python-dazl-client/4538) directly, where is is possible to manage tokens, and to my understanding this isn’t possible using the daml-dit-if.  
Is it possible make such an integration run externally to daml hub?

---

<div class="post-metadata">

**Author:** ![alex.graham](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/alex.graham/32/830_2.png) [@alex.graham](https://forum.canton.network/u/alex.graham)\
**Post date:** [July 26, 2022, 5:56pm UTC](https://forum.canton.network/t/running-ddit-integration-outside-of-daml-hub/4976/2 "2022-07-26T17:56:07Z")

</div>

Hi @David_Martins,

We just released a new version of `daml-dit-if` (`0.6.7`) which should allow you to use a Daml Hub JWT token to access the ledger.

You’ll need to add the following line to the `requirements.txt` for your integration:

```haskell
dazl[oauth]

```

Next run `ddit clean`, then `ddit install`.

Following those steps, you should be able to specify the auth token with the `DAML_LEDGER_TOKEN` environment variable like as follows (sans brackets):

```haskell
DABL_LEDGER_URL=https://{ledger_id}.daml.app DAML_LEDGER_TOKEN={jwt_token} ddit run {integration_type_id} --party {ledger_party}

```

The auth token should be the token for the specific party the integration is meant to run as, which can be found in the Identities tab.

Let me know if this works for you.

---

<div class="post-metadata">

**Author:** ![David\_Martins](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/david_martins/32/1792_2.png) [@David\_Martins](https://forum.canton.network/u/David_Martins)\
**Post date:** [July 27, 2022, 4:00pm UTC](https://forum.canton.network/t/running-ddit-integration-outside-of-daml-hub/4976/3 "2022-07-27T16:00:19Z")

</div>

Hello @alex.graham,

I’ve have tried the solution you’ve suggested, and i can confirm that connection is indeed possible with these steps.  
Thank you.
