Problems Deploying Internet Identity Locally

Hey guys,

I’ve been having trouble trying to deploy a local copy of the internet identity. I followed the steps given in https://github.com/dfinity/internet-identity/blob/main/README.md for running II locally. Specifically, I used dfx start from the /internet_identity folder, followed by II_ENV=development dfx deploy --no-wallet --argument '(null)'. Then I deployed the whoami canister to the same IC replica and started the front end from the demos folder https://github.com/dfinity/internet-identity/tree/main/demos.

I am able to use the “whoami” button to call the canister without issue if I don’t login, but when I try to login I get stuck trying to confirm my device registration for a new II anchor:

I also tried running dfx start from the /internet_identity/demos/whoami folder and then deploying both canisters to that replica. Doing it this way I don’t get stuck but I end up with a 403 (Forbidden) error stating:

Failed to authenticate request 0xb5c4a510754b5da7da2ee92fbc456f62c1dcde311e44e221a2969a30614bda42 due to: Invalid delegation: Invalid public key: Algorithm Placeholder not supported: Unsupported public key

Has anyone faced similar issues? Any advice is much appreciated :pray:

Did you try this?

agent.fetchRootKey()

However, you can see the II integration here (unfortunately the dfx version 0.7.2 is a little outdated here)

You’re probably trying to use Windows Hello, but your local replica doesn’t support RSA signatures yet. The version of the replica dfx ships probably is too old.

For local testing you can either use a Yubikey (or equivalent) if you have one or Chrome’s Virtual Authenticator. At some point in the future Windows Hello will also work.

2 Likes

I’m pretty sure we got the Windows Hello replica version into 0.8.1

The virtual authenticator worked, thank you! Also for reference, this was using dfx 0.8.1 so I guess Windows Hello support hasn’t made it into that replica yet.


I get redirected to app with keys but get error. Not sure if anyone has seen this error before.

Hi, @cyberowl
Try to set host without ?canisterId. And as far as I know replica’s default URL is http://127.0.0.1:8000

new HttpAgent({
	identity, // your identity
	host: 'http://127.0.0.1:8000',
});

Did you run II and app on the same port? Now I get POST http://127.0.0.1:8000/api/v2/canister/r7inp-6aaaa-aaaaa-aaabq-cai/call 404 (Not Found) because I am running on diff port

yes, but not in dev-server-mode. In my case:

dfx start --background

# start II first
cd ../internet-identity
rm -rf ./.dfx
II_ENV=development dfx deploy --no-wallet --argument '(null)'
echo "http://localhost:8000?canisterId=$(dfx canister id internet_identity)"
# II canister has rk4pc... canisterId in this setup

# deploy my app
cd ../my-app
dfx deploy
open http://localhost:8000?canisterId=$(dfx canister id my-app) # opens deployed application not in dev-mode

Then in my app

const client = await AuthClient.create({});
await client.login({
  identityProvider: window.location.href.includes('localhost') ? 'http://127.0.0.1:8000?canisterId=rk4pc...' : 'https://identity.ic0.app',
  onSuccess: async () => { 
    const identity = client.getIdentity();

    const agent = new HttpAgent({
	   identity,
	   host: window.location.href.includes('localhost') ? 'http://127.0.0.1:8000' : undefined,
     });

    // Make deal with agent
  },
});

If you are using dev-server-mode (webpack, vite, etc), you need to add proxy

proxy: {
  '/api': 'http://localhost:8000'
}
2 Likes

Just in case somebody finds this via google: setting up Internet Identity locally is easier now, see the example here.