> For the complete documentation index, see [llms.txt](https://support.backpack.exchange/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.backpack.exchange/support-docs/vn/vi-wallet/tai-lieu-ky-thuat/deeplinks/cac-phuong-thuc-provider/ket-noi.md).

# Kết Nối

Trước khi một ứng dụng có thể tương tác với Backpack, ứng dụng đó cần phải thiết lập kết nối trước. Yêu cầu kết nối này sẽ yêu cầu người dùng xác nhận chia sẻ public key, thể hiện sự đồng ý tiếp tục sử dụng dịch vụ.&#x20;

Khi người dùng kết nối thành công, Backpack sẽ cung cấp một tham số session (phiên kết nối). Tham số này phải được sử dụng cho tất cả các phương thức tiếp theo.

{% hint style="info" %}
Vui lòng tham khảo thêm phần [Handling Sessions](broken://pages/XkwAjjvmdBNyhgvfc29p) để biết thêm chi tiết.
{% endhint %}

## URL cơ sở

```
https://backpack.app/ul/v1/connect
```

## Tham số Chuỗi Truy vấn

* `app_url` (bắt buộc): URL cung cấp metadata của ứng dụng (ví dụ: tiêu đề, icon). URL này phải được mã hóa (URL-encoded).
* `dapp_encryption_public_key` (bắt buộc): Public key dùng cho mã hóa đầu cuối (end-to-end encryption), nhằm tạo ra shared secret (khóa dùng chung). Xem thêm chi tiết trong phần [Encryption](broken://pages/NAJcuZG486Q2zBT5Xu0v) để hiểu cách Backpack quản lý shared secret.
* `redirect_link` (bắt buộc): Địa chỉ URI để Backpack chuyển hướng người dùng sau khi kết nối thành công. Tham khảo thêm phần [Specifying Redirects](broken://pages/eEN4Je3hS9GkJD2llYkD) để biết chi tiết. Phải được mã hóa URL.
* `cluster` (tùy chọn): Chỉ định mạng lưới cho các tương tác sau khi kết nối. Để kết nối Solana mainnet, không cần điền hoặc điền là `mainnet-beta`. Để kết nối Eclipse, điền tham số:`solana:EAQLJCV2mh23BsK2P9oYpV5CHVLDNHTxY`.

## Kết Quả Trả Về

### Chấp Nhận

* `wallet_xxx`: Một public key mã hóa theo chuẩn Base58 được Backpack sử dụng để tạo khóa bảo mật chung (shared secret) giữa ứng dụng đang kết nối và Backpack.
* `nonce`: Một nonce được mã hóa theo chuẩn Base58, dùng để mã hóa phản hồi trả về..
* `data`: Chuỗi JSON đã được mã hóa. Tìm hiểu cách các ứng dụng có thể giải mã dữ liệu bằng cách sử dụng một shared secret trong [Encryption](broken://pages/NAJcuZG486Q2zBT5Xu0v). Base58 được sử dụng để mã hóa các byte đã được mã hóa.&#x20;

  ```
  // content of decrypted `data`-parameter
  {
    // base58 encoding of user public key
    "public_key": "3huUrtWW5s5ew98eUFRYz9LPsDUQTujNzzYaB9DBkppQ",

    // session token for subsequent signatures and messages
    // apps should send this with any other deeplinks after connect
    "session": "..."
  }
  ```

  * `public_key`: Khóa công khai của người dùng, được biểu diễn dưới dạng chuỗi được mã hóa base58.
  * `session`: Một chuỗi được mã hóa bằng base58. Ứng dụng kết nối nên coi chuỗi này là opaque, vì nó chỉ cần được truyền cùng với các tham số khác. Các phiên không hết hạn. Để biết thêm thông tin về các phiên, vui lòng tham khảo  [Handling Sessions](broken://pages/XkwAjjvmdBNyhgvfc29p).

### Từ chối

Một  `errorCode` và  `errorMessage` dưới dạng các tham số truy vấn.

Vui lòng tham khảo [Errors](broken://pages/T3LxDBNiZXh6Q2nP7dhl#errors) để xem danh sách đầy đủ các mã lỗi có thể xảy ra.&#x20;

#### &#x20; <a href="#approve" id="approve"></a>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://support.backpack.exchange/support-docs/vn/vi-wallet/tai-lieu-ky-thuat/deeplinks/cac-phuong-thuc-provider/ket-noi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
