# 客戶身份驗證

### **準備驗證相關參數**

你的網站需先由後端透過 API 請求一組驗證代碼，其他參數需包含一組 secret 與提供的驗證資料(電子郵件、電話號碼等)。

![](/files/-MQp4UYLw0NkpvA5yOTC)

### **呼叫 API 取得驗證代碼**

因應安全性，取得的代碼為一次性，使用後將立即失效，若有新需要時需再次請求。

&#x20;**HTTP request**`GET https://01.firstline.cc/livechat/messenger/9/apply-query-request?secret={secret}`

#### Response

```
 {
    "code": "fl0db2xl-efab-46ce-bd88-c253ab0c7913",
    "criteria": null,
    "created_at": 1608099124,
    "expired_at": 1608102723,
    "livechat_account_id": 3
}
                
```

若出現 404 代碼，表示沒有相對應條件客戶或找到多筆客戶。

&#x20;**範例**`https://dev.dev.firstline.cc/livechat/messenger/9/apply-query-request?secret=5f49b304-89f0-495b-9a5c-5a216b53cdbc&membership_no=FL0092`

### **將一次性代碼組合至網址**

&#x20;當後端收到驗證代碼(code)後，需將其組合至嵌入代碼內 JavaScript 網址，如 `https://dev.dev.firstline.cc/livechat.5c626c29-bd95-4d73-91b6-f58774a5c109.js?t=1610337630&once_code={once_code}`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.firstline.cc/feature/channels/live-chat/ke-hu-shen-fen-yan-zheng.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
