> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/feature/channels/live-chat/ke-hu-shen-fen-yan-zheng.md).

# Customer authentication

In certain use cases, if your website already knows the customer's login information, such as email, phone number, or member ID, you can perform customer authentication for FIRST LINE through integration.

### **Preparing verification-related parameters**

Your website must first request a verification code from the backend via API; other parameters should include a secret and the provided verification data (email, phone number, etc.).

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MQp2r-1qOViegyX8kZh%2F-MQp4UYLw0NkpvA5yOTC%2Fimage.png?alt=media\&token=d93e5809-1f9e-4347-9062-0197ee55e62c)

### **Call the API to obtain the verification code**

For security reasons, the obtained code is one-time use and will expire immediately after use; if needed again, you must request it again.

&#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
}
                
```

If a 404 code appears, it means no matching customer conditions were found or multiple customers were found.

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

### **Combine the one-time code into the URL**

&#x20;When the backend receives the verification code (code), it needs to combine it into the JavaScript URL within the embed code, such as `https://dev.dev.firstline.cc/livechat.5c626c29-bd95-4d73-91b6-f58774a5c109.js?t=1610337630&once_code={once_code}`
