How to properly set up local environment with II and dApp

I’m trying to replicate the environment based on demo repo by Kyle So that I can locally make authenticated calls to the IC.

When I call simple whoami function → with an agent that is authenticated I get an Invalid combined threshold signature error saying that the delegation is invalid.

public shared (msg) func whoami() : async Principal { msg.caller };

I believe it’s because I’ve set up something wrongly.
Currently I run 2 dfx replicas - one for II and one for dApp. Each on different port. I linked the II in the dApp with this URL http://rwlgt-iiaaa-aaaaa-aaaaa-cai.localhost:8888/#authorize.

Maybe the signature fails because of the intricacies of local hostnames?

1 Like

Thanks for the detailed explanation! I can pretty confidently say that the issue is because the independent replicas will not accept signatures from the other.

Go through the Setting Up for Development flow again, but this time only run dfx start from the auth-client-demo directory. dfx deploy in the II directory will successfully install II on the already running replica, and everything else should work fine!


Thanks Kyle!
I’m pretty sure I’ve tried to do it on one replica but must have crooked something in between.

Done it once again from clean repos and it worked :slight_smile:

When using multiple projects at the same time, either start from new folders, or remove the .dfx folder inside the projects, and retry (usually works best with a dfx start --clean). This solved a lot of headaches for me when playing around with the Internet Identity canister and other dev canisters that I wanted to play with.