NFID asks AWS and fails... weird

While authenticating in my dapp with NFID, I got:

POST https://28oge2ricd.execute-api.us-east-1.amazonaws.com/prod/ecdsa_sign
400 Bad Request

The returned body is {}.

Why does it query AWS, and why the request is bad?

My login code:

      const nfid = await NFID.init({
        application: {
          name: "Zon",
          // logo: "https://dev.nfid.one/static/media/id.300eb72f3335b50f5653a7d6ad5467b3.svg" // TODO
        },
      });
      const delegationIdentity: Identity = await nfid.getDelegation({
        // optional targets ICRC-28 implementation, but required to support universal NFID Wallet auth
        targets: [], // FIXME: needed?
        // optional derivationOrigin in case you're running on a custom domain
        derivationOrigin: `https://${process.env.CANISTER_ID_frontend!}.icp0.app`,
        // optional maxTimeToLive defaults to 8 hours in nanoseconds;
        maxTimeToLive: BigInt(8) * BigInt(3_600_000_000_000) // TODO
      });
      updateClientNfid(delegationIdentity);
      if (getIsLocal()) {
        auth.authClient.fetchRootKey();
      }

Also, do I need any targets?

2 Likes

It also returns X-Cache: Error from cloudfront in the POST response. What is it?

I’ve reported it as NFID-SDK issue.

Did you contact NFID on their Discord?

No, but I will contact on Discord.

1 Like

Thank you for reporting this :pray:

The issue in our new alpha SDK and now fixed - no version update required.

You do not need to set targets (see ICRC-28) unless you want to allow users to authenticate with their wallets. Reason for targets is to enforce wallet approval prompts when making calls to canisters that aren’t yours.

1 Like

I run npm i @nfid/embed@^0.10.0-alpha.1 and the error didn’t disappear after dfx deploy frontend. So, it appears your claim of it having been fixed in this alpha version is false.

Moreover, the error didn’t disappear after upgrading to 0.10.0-alpha.2.