|
| 1 | +--- |
| 2 | +title: "Face liveness quick link - Face" |
| 3 | +titleSuffix: Azure AI services |
| 4 | +description: This article explains the concept of Face liveness quick link, its usage flow, and related concepts. |
| 5 | +author: JinyuID |
| 6 | +manager: nitinme |
| 7 | + |
| 8 | +ms.service: azure-ai-vision |
| 9 | +ms.subservice: azure-ai-face |
| 10 | +ms.topic: conceptual |
| 11 | +ms.date: 05/15/2025 |
| 12 | +ms.author: pafarley |
| 13 | +feedback_help_link_url: https://learn.microsoft.com/answers/tags/156/azure-face |
| 14 | +--- |
| 15 | + |
| 16 | +# Face Liveness quick link (preview) |
| 17 | + |
| 18 | +This article explains the concept of Face liveness quick link, its usage flow, and related concepts. |
| 19 | + |
| 20 | +## Introduction |
| 21 | + |
| 22 | +Azure Face Liveness quick link is an optional integration path for [Face liveness detection](concept-face-liveness-detection.md). It exchanges a liveness session’s session-authorization-token for a single-use URL that hosts the face capture experience on an Azure-operated page. The service returns to a developer-supplied callback endpoint after finishing the operation. |
| 23 | + |
| 24 | +Azure Liveness quick link provides multiple benefits to customers: |
| 25 | +- You don't need to embed the liveness client SDK. That allows for easier integration on the application side. |
| 26 | +- You don't need to keep track of liveness client SDK updates. Azure-operated websites always use the latest version of liveness detection. |
| 27 | + |
| 28 | +## How it works |
| 29 | + |
| 30 | +You can use the liveness quick link website, `liveness.face.azure.com`, to turn a liveness session into a shareable, single use link: |
| 31 | + |
| 32 | +:::image type="content" source="media/liveness/liveness-quick-link-diagram.png" alt-text="A diagram illustrates liveness quick link work flow."::: |
| 33 | + |
| 34 | +1. Start a session with your server-side code. Your application backend requests a new liveness session from the Face API and receives a short-lived authorization token that represents that session. |
| 35 | +2. Swap the session token for a link. Your application backend sends the token to the quick link service, which creates a one-time URL connected to the session. Here are examples of the post request: |
| 36 | + |
| 37 | + #### [C#](#tab/csharp) |
| 38 | + ```csharp |
| 39 | + var client = new HttpClient(); |
| 40 | + var request = new HttpRequestMessage |
| 41 | + { |
| 42 | + Method = HttpMethod.Post, |
| 43 | + RequestUri = new Uri("https://liveness.face.azure.com/api/quicklink"), |
| 44 | + Headers = |
| 45 | + { |
| 46 | + { "authorization", "Bearer <session-authorization-token>" }, |
| 47 | + }, |
| 48 | + }; |
| 49 | + using (var response = await client.SendAsync(request)) |
| 50 | + { |
| 51 | + response.EnsureSuccessStatusCode(); |
| 52 | + var body = await response.Content.ReadAsStringAsync(); |
| 53 | + Console.WriteLine(body); |
| 54 | + } |
| 55 | + ``` |
| 56 | + |
| 57 | + #### [Java](#tab/java) |
| 58 | + ```java |
| 59 | + HttpRequest request = HttpRequest.newBuilder() |
| 60 | + .uri(URI.create("https://liveness.face.azure.com/api/quicklink")) |
| 61 | + .header("authorization", "Bearer <session-authorization-token>") |
| 62 | + .method("POST", HttpRequest.BodyPublishers.noBody()) |
| 63 | + .build(); |
| 64 | + HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); |
| 65 | + System.out.println(response.body()); |
| 66 | + ``` |
| 67 | + |
| 68 | + #### [Python](#tab/python) |
| 69 | + ```python |
| 70 | + import http.client |
| 71 | + |
| 72 | + conn = http.client.HTTPSConnection("liveness.face.azure.com") |
| 73 | + |
| 74 | + headers = { |
| 75 | + 'authorization': "Bearer <session-authorization-token>" |
| 76 | + } |
| 77 | + |
| 78 | + conn.request("POST", "/api/quicklink", headers=headers) |
| 79 | + |
| 80 | + res = conn.getresponse() |
| 81 | + data = res.read() |
| 82 | + |
| 83 | + print(data.decode("utf-8")) |
| 84 | + |
| 85 | + ``` |
| 86 | + |
| 87 | + #### [JavaScript](#tab/javascript) |
| 88 | + ```javascript |
| 89 | + fetch("https://liveness.face.azure.com/api/quicklink", { |
| 90 | + "method": "POST", |
| 91 | + "headers": { |
| 92 | + "authorization": "Bearer <session-authorization-token>" |
| 93 | + } |
| 94 | + }) |
| 95 | + .then(response => { |
| 96 | + console.log(response); |
| 97 | + }) |
| 98 | + .catch(err => { |
| 99 | + console.error(err); |
| 100 | + }); |
| 101 | + ``` |
| 102 | + |
| 103 | + #### [REST(Windows)](#tab/cmd) |
| 104 | + ```console |
| 105 | + curl --request POST ^ |
| 106 | + --url https://liveness.face.azure.com/api/quicklink ^ |
| 107 | + --header 'authorization: Bearer <session-authorization-token>' |
| 108 | + ``` |
| 109 | + |
| 110 | + #### [REST(Linux)](#tab/bash) |
| 111 | + ```bash |
| 112 | + curl --request POST \ |
| 113 | + --url https://liveness.face.azure.com/api/quicklink \ |
| 114 | + --header 'authorization: Bearer <session-authorization-token>' |
| 115 | + ``` |
| 116 | + |
| 117 | + |
| 118 | +The following is an example response: |
| 119 | + |
| 120 | + ```json |
| 121 | + { |
| 122 | + "url": "/?s=60c3980c-d9f6-4b16-a7f5-f1f4ad2b506f" |
| 123 | + } |
| 124 | + ``` |
| 125 | + |
| 126 | +Use that value to construct the liveness quick link web page: `https://liveness.face.azure.com/?s=60c3980c-d9f6-4b16-a7f5-f1f4ad2b506f` |
| 127 | + |
| 128 | +3. Send the link to the user. You can redirect the browser, show a button, or display a QR code—anything that lets the user open the link on a camera-enabled device. |
| 129 | +4. Azure hosts the capture experience. When the link opens, the Azure-operated page guides the user through the liveness check sequence using the latest Liveness web client. |
| 130 | +5. Get the outcome callback. As soon as the check finishes—or if the user abandons or times out—the quick link service notifies your callback endpoint so your application can decide what happens next. |
| 131 | + |
| 132 | +## Quick link URL handling |
| 133 | + |
| 134 | +The URL returned by the quick link service is a bearer secret: anyone who possesses the link can initiate, complete, or cancel the associated liveness session. If a malicious party intercepts the link before the intended user opens it, they can consume or spoof the session and prevent the legitimate user from completing the check—creating a repudiation and impersonation risk. To minimize this risk, transmit the link only over protected channels, avoid persisting it in logs or analytics, and, when possible, lowering lifetime of the liveness session. |
0 commit comments