This repo is a forkable example designed to help you seamlessly implement Internet Identity authentication into your projects.
git clone https://github.com/your-username/internet-identity-integration.git
cd internet-identity-integration
Ensure you have the following installed:
npm install
Run the following command to start your local Internet Computer replica:
dfx start --clean --background
Note: Take note of the port the replica is running on, e.g., Replica API running on 127.0.0.1:8080
.
dfx canister create internet_identity --specified-id rdmx6-jaaaa-aaaaa-aaadq-cai
This will create and deploy the backend, frontend, and Internet Identity canisters:
dfx deploy
After deployment, you can view the application at:
http://127.0.0.1:8080/?canisterId=yourcanisterid
http://yourcanisterid.localhost:8080/
Run the application:
http://127.0.0.1:8080/?canisterId=yourcanisterid
http://yourcanisterid.localhost:8080/
Click "Login" to authenticate via Internet Identity.
Verify your principal appears after successful login.
If you encounter ECONNREFUSED 127.0.0.1:4943
or a similar error, modify the code to use the port number specified in your Replica API running on 127.0.0.1:8080.
Happy building with Internet Identity!