Skip to content
Discussions/App Development/Cannot log in with DABL (following private NFT example)Forum ↗

Cannot log in with DABL (following private NFT example)

App Development8 posts413 views3 likesLast activity Aug 2022
BO
Bogdan_SataricOP
Mar 2022

Hello,

I just started learning DAML 2 weeks ago and went through the private NFT example created by Levente Barczy.

I encountered various problems at different steps like: starting up navigator, linking DAML with React UI and lastly staring the depolyment zip on DAML hub. I circumvented first two issues but in order to do that I needed to compile everything with DAML version 1.3.1 (as used in tutorial). Otherwise things simply don’t work with 2.0.0 and I think you need an update of tutorials since old ones are not compatible with 2.0.0. and can create a lot of headaches for new developers.

However the last problem starting the deployment zip on DAML hub I cannot solve. I did everything as Levente and tried starting the deployed UI (basically last step of the private NFT tutiroal) and it goes to this address: https://cghiveu9q9h7iy5i.daml.app/#/login. Then there is an option to “Log in with DABL”.

When I click the button however I get the message:

This login.daml.app page can’t be found

No webpage was found for the web address: https://login.daml.app/auth/login?ledgerId=cghiveu9q9h7iy5i

HTTP ERROR 404

I tried finding the solution on the forum and it seems it has to do (again) with changes from 1.3.1 to 2.0.0. but I don’t know how to solve it exactly.

Thanks in advance,

Bogdan

AL
Alex_Matson
Mar 2022

Hi @Bogdan_Sataric ,

This sounds like a problem at the application level. It seems like the app UI is relying on the legacy log-in endpoint which will not work with the new *.daml.app application domains. There are more details about this change here: https://hub.daml.com/docs/app-domains/

The UI code must be updated to hit the new login endpoint /.hub/v1/login rather than login.projectdabl.com/...

You should reach out to the application author to patch this, or, if you have access to the source code, you can try patching it yourself. It should be a relatively simple fix.

Let me know if you have any further questions!

NE
nemanja
Mar 2022

Welcome to the Daml developer forum @Bogdan_Sataric :wave:

Bogdan_Sataric:

I encountered various problems at different steps like: starting up navigator, linking DAML with React UI and lastly staring the depolyment zip on DAML hub. I circumvented first two issues but in order to do that I needed to compile everything with DAML version 1.3.1 (as used in tutorial).

We really appreciate the feedback and will try to update the tutorial as soon as possible. if you could share the errors you encountered with different steps that would help.

cc @Levente_Barczy

BO
Bogdan_Sataric
Mar 2022
Alex_Matson:

/.hub/v1/login

Thanks!

I think what you are talking about and what needs to be changed is contained in this line:

github.com

LeventeBarczyDA/private-nft/blob/8cda0b0f34357f9dde5d09a565139ef46c200488/ui/src/config.ts#L25


      
  1. // Unfortunately, the development server of `create-react-app` does not proxy
  2. // websockets properly. Thus, we need to bypass it and talk to the JSON API
  3. // directly in development mode.
  4. export const wsBaseUrl = isLocalDev ? 'ws://localhost:7575/' : undefined;
  5. export const createToken = (party : string) => jwt.sign({ "https://daml.com/ledger-api": { ledgerId, applicationId, admin: true, actAs: [party], readAs: [party] } }, "secret")
  6. let loginUrl = host.slice(1)
  7. loginUrl.unshift('login')
  8. export const dablLoginUrl = loginUrl.join('.') + (window.location.port ? ':' + window.location.port : '') + '/auth/login?ledgerId=' + ledgerId;
  9. export const damlPartyKey = applicationId + ".daml.party";
  10. export const damlTokenKey = applicationId + ".daml.token";

or within that file.

However I tried changing it/patching it somehow with the /.hub/v1/login , for example:

export const dablLoginUrl = loginUrl.join(‘.’) + (window.location.port ? ‘:’ + window.location.port : ‘’) + ‘/.hub/v1/login’;

But that breaks even previous page and even login page cannot open.

There seem to be a lot of URL dependecies here so I’m not sure what to change exactly.

BO
Bogdan_Sataric
Mar 2022

Thanks!

So the errors I enocuntered are:

  1. Episode 3 - Daml Connect SDK tooling.

If I recall correctly Navigator displays contracts if compiled with SDK 2.0.0. only if yaml.daml doesn’t contain parties but that they are created inside main.daml with the syntax needed for 2.0.0 (I cannot remember exact syntax because I had to rollback to 1.3.1 to make it work but I know it has to do with creating unique IDs as part of the party names - for example Alice:LONG_ID).

Otherwise no contracts are displayed if it’s done as in tutorial + SDK 2.0.0.

  1. Episode 5.2 - Frontend UI with React.

I was receiving this error:

Module not found: Can’t resolve ‘@daml.js/40f452260bef3f29dede136108fc08a88d5a5250310281067087da6f0baddff7’ in 'C:\Users\bogs\Projects\private-nft\nft\daml.js\nft-0.0.1\lib\Token

When trying npm start after npm install --force. Then I realized that I should drop using npm alltogether and should use yarn. Also I avoided updating packages and used obsolete packages as in github package.json because I think updates break things.

Last but not least I had to use SDK 1.3.1 again because 2.0.0. I think also adds to the linking problem. I’m not absolutley sure which of these things helped me fixe the issue (maybe even only using yarn instead of npm and keeping same packages). I’m coming from Vue ecosystem so I’m very new to React as well and I’m not sure if React dependencies are installed correctly via npm or yarn is native for React.

  1. There might have been some other minor issues, such as not showing all the changes made in all the files from the template ones for example but I circumvented those by comparing file by file from the template code vs the private nft one
NE
nemanja
Mar 2022

Thanks a bunch for the detailed report @Bogdan_Sataric, much appreciated :pray:

AR
arya
Aug 2022

@Alex_Matson @nemanja and for anyone following here, the auth url seems to be updated to .hub/v1/auth/login, as shown here https://hub.daml.com/docs/api/#tag/Login.

The docs here https://hub.daml.com/docs/app-domains/ still show the old path /.hub/v1/login that does not work anymore.

AL
Alex_Matson
Aug 2022

Good catch! We’ll be sure to correct the documentation.

← Back to Discussions