You’re likely hitting the live public Internet Identity, and then trying to use that on your localhost dev environment. It won’t work, since the root keys are different for the live IC vs. your dev environment. You can either try to push your test canister to production and test there, or you can install the Internet Identity canister locally (should be able to find a tutorial on this with some googling, I remember seeing one) and authenticate against that. Both solutions will work.