diff --git a/docs/developer-docs/integrations/_attachments/II_greet_1.png b/docs/developer-docs/integrations/_attachments/II_greet_1.png
index 7c734cb4e1..f52211fbb3 100644
Binary files a/docs/developer-docs/integrations/_attachments/II_greet_1.png and b/docs/developer-docs/integrations/_attachments/II_greet_1.png differ
diff --git a/docs/developer-docs/integrations/_attachments/II_greet_2.png b/docs/developer-docs/integrations/_attachments/II_greet_2.png
index bcbce70dab..fccee840b6 100644
Binary files a/docs/developer-docs/integrations/_attachments/II_greet_2.png and b/docs/developer-docs/integrations/_attachments/II_greet_2.png differ
diff --git a/docs/developer-docs/integrations/internet-identity/integrate-identity.md b/docs/developer-docs/integrations/internet-identity/integrate-identity.md
index 8fce2d9795..8b14c0d1a1 100644
--- a/docs/developer-docs/integrations/internet-identity/integrate-identity.md
+++ b/docs/developer-docs/integrations/internet-identity/integrate-identity.md
@@ -100,35 +100,22 @@ import {
ii_integration_backend,
} from "../../declarations/ii_integration_backend";
import { AuthClient } from "@dfinity/auth-client";
-import { HttpAgent, Actor } from "@dfinity/agent";
-
+import { HttpAgent } from "@dfinity/agent";
let actor = ii_integration_backend;
-
console.log(process.env.CANISTER_ID_INTERNET_IDENTITY);
-
-const greetButton = document.getElementById("greet");
-greetButton.onclick = async (e) => {
+const whoAmIButton = document.getElementById("whoAmI");
+whoAmIButton.onclick = async (e) => {
e.preventDefault();
-
- greetButton.setAttribute("disabled", true);
-
- const greeting = await actor.greet(
- (await Actor.agentOf(actor).getPrincipal()).toString()
- );
-
- greetButton.removeAttribute("disabled");
-
- document.getElementById("greeting").innerText = greeting;
-
+ whoAmIButton.setAttribute("disabled", true);
+ const principal = await actor.whoami();
+ whoAmIButton.removeAttribute("disabled");
+ document.getElementById("principal").innerText = principal.toString();
return false;
};
-
const loginButton = document.getElementById("login");
loginButton.onclick = async (e) => {
e.preventDefault();
-
let authClient = await AuthClient.create();
-
// start the login process and wait for it to finish
await new Promise((resolve) => {
authClient.login({
@@ -139,31 +126,29 @@ loginButton.onclick = async (e) => {
onSuccess: resolve,
});
});
-
const identity = authClient.getIdentity();
const agent = new HttpAgent({ identity });
actor = createActor(process.env.CANISTER_ID_II_INTEGRATION_BACKEND, {
agent,
});
-
return false;
};
```
This code does the following:
-- Interacts with the backend actor to call the `greet` method.
+- Interacts with the backend actor to call the `whoami` method.
- Creates an `auth` client.
-- Retrieves the Internet Identity from the `auth` client.
-- Uses the Internet Identity to create an agent that interacts with the IC.
+- Retrieves the identity from the `auth` client.
+- Uses the identity to create an agent that interacts with the IC.
- Then, uses the interface description of the app to create an actor that's used to call the app's service methods.
-### Step 8: Insert the following code into the `src/ii_integration_frontend/src/index.html` file:
-
:::info
-If you used a project name other than `ii_integration`, you will need to rename the inputs in the code.
+If you used a project name other than `ii_integration`, you will need to rename the imports and environment variable in the code.
:::
+### Step 8: Insert the following code into the `src/ii_integration_frontend/src/index.html` file:
+
```html
@@ -185,9 +170,9 @@ If you used a project name other than `ii_integration`, you will need to rename