Hướng dẫn này sẽ hướng dẫn bạn cách thiết lập OAuth2 để truy cập API bằng thông tin xác thực của riêng bạn thông qua tài khoản dịch vụ.
Bạn chỉ cần thực hiện các bước này một lần, trừ phi bạn thu hồi hoặc xoá thông tin xác thực OAuth2.
Thêm khoá riêng tư JSON và email giả mạo vào cấu hình
Đặt đường dẫn tệp JSON khoá riêng tư và email được mạo danh trong cấu hình.
Nếu bạn đang sử dụng tệp google-ads.yaml, chuỗi YAML hoặc dict, hãy thêm nội dung sau:
[null,null,["Cập nhật lần gần đây nhất: 2025-03-04 UTC."],[[["This guide explains how to set up OAuth2 for API access using service accounts, a one-time process unless credentials are revoked."],["The setup requires a Google Workspace domain and a service account with domain-wide delegation access granted by a super administrator."],["You need to generate a service account ID and a JSON file, then add the private key JSON file path and impersonated email to your configuration."],["Configuration can be set using a `google-ads.yaml` file, YAML string, `dict`, or environment variables."],["The library prioritizes credentials for desktop or web app flows, so ensure these are not present if you want to use Service Account authentication."]]],[]]