Skip to content

Commit 4525701

Browse files
authored
docs: clarify two different verification record IDs in Account API (#1338)
Add info boxes and code comments to distinguish between: - logto-verification-id (header): proves user identity - newIdentifierVerificationRecordId (body): proves ownership of new identifier This helps users understand which verification ID to use where when linking email, phone, or social connections.
1 parent 4c76f45 commit 4525701

File tree

1 file changed

+26
-4
lines changed

1 file changed

+26
-4
lines changed

docs/end-user-flows/account-settings/by-account-api.mdx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,12 +251,23 @@ curl -X POST https://[tenant-id].logto.app/api/verifications/verification-code/v
251251

252252
After verifying the code, you can now call [`PATCH /api/my-account/primary-email`](https://openapi.logto.io/operation/operation-updateprimaryemail) to update the user's email, set the `verificationId` to the request body as `newIdentifierVerificationRecordId`.
253253

254+
:::info[Two different verification record IDs]
255+
256+
This request requires two separate verification record IDs:
257+
258+
- **`logto-verification-id` (header)**: Proves the user's identity before making sensitive changes. Obtain this by [verifying the user's password](#verify-the-users-password) or [sending a verification code to the user's existing email or phone](#verify-by-sending-a-verification-code-to-the-users-email-or-phone).
259+
- **`newIdentifierVerificationRecordId` (body)**: Proves ownership of the new email address. This is the `verificationRecordId` returned from the `POST /api/verifications/verification-code` call above.
260+
261+
:::
262+
254263
```bash
255264
curl -X POST https://[tenant-id].logto.app/api/my-account/primary-email \
256265
-H 'authorization: Bearer <access_token>' \
257-
-H 'logto-verification-id: <verification_record_id>' \
266+
# Verifies user identity (from password or existing email/phone verification)
267+
-H 'logto-verification-id: <verification_record_id_from_existing_identifier>' \
258268
-H 'content-type: application/json' \
259-
--data-raw '{"email":"...","newIdentifierVerificationRecordId":"..."}'
269+
# The "newIdentifierVerificationRecordId" proves ownership of the new email (from the verification code flow above)
270+
--data-raw '{"email":"...","newIdentifierVerificationRecordId":"<verification_record_id_from_new_email>"}'
260271
```
261272

262273
:::tip
@@ -311,12 +322,23 @@ The `connectorData` is the data returned by the social connector after the user
311322

312323
Finally, you can use the [`POST /api/my-account/identities`](https://openapi.logto.io/operation/operation-adduseridentities) endpoint to link the social connection.
313324

325+
:::info[Two different verification record IDs]
326+
327+
This request requires two separate verification record IDs:
328+
329+
- **`logto-verification-id` (header)**: Proves the user's identity before making sensitive changes. Obtain this by [verifying the user's password](#verify-the-users-password) or [sending a verification code to the user's existing email or phone](#verify-by-sending-a-verification-code-to-the-users-email-or-phone).
330+
- **`newIdentifierVerificationRecordId` (body)**: Identifies the social identity being linked. This is the `verificationRecordId` returned from the `POST /api/verifications/social` call above.
331+
332+
:::
333+
314334
```bash
315335
curl -X POST https://[tenant-id].logto.app/api/my-account/identities \
316336
-H 'authorization: Bearer <access_token>' \
317-
-H 'logto-verification-id: <verification_record_id>' \
337+
# Verifies user identity (from password or existing email/phone verification)
338+
-H 'logto-verification-id: <verification_record_id_from_existing_identifier>' \
318339
-H 'content-type: application/json' \
319-
--data-raw '{"newIdentifierVerificationRecordId":"..."}'
340+
# The "newIdentifierVerificationRecordId" identifies the social connection to link (from the social verification flow above)
341+
--data-raw '{"newIdentifierVerificationRecordId":"<verification_record_id_from_social>"}'
320342
```
321343

322344
### Remove a social connection \{#remove-a-social-connection}

0 commit comments

Comments
 (0)