Sử dụng tính năng Kiểm tra ứng dụng bằng trình cung cấp gỡ lỗi trong Unity
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Sau khi bạn đăng ký ứng dụng cho App Check, ứng dụng của bạn thường sẽ không chạy trên các nền tảng máy tính, trong trình mô phỏng hoặc từ môi trường tích hợp liên tục (CI), vì những môi trường đó không đủ điều kiện là thiết bị hợp lệ. Nếu muốn chạy ứng dụng trong môi trường như vậy trong quá trình phát triển và kiểm thử, bạn có thể tạo một bản gỡ lỗi của ứng dụng sử dụng trình cung cấp gỡ lỗi App Check thay vì trình cung cấp chứng thực thực.
Cấu hình thông qua mã
Để sử dụng trình cung cấp gỡ lỗi trong khi chạy ứng dụng (ví dụ: trong quá trình phát triển), hãy làm như sau:
Trong phần App Check của bảng điều khiển Firebase, hãy chọn Quản lý mã gỡ lỗi trong trình đơn tràn của ứng dụng. Sau đó, hãy tạo một mã thông báo gỡ lỗi mới. Bạn sẽ cần mã thông báo này trong bước tiếp theo.
Vì mã thông báo này cho phép truy cập vào các tài nguyên Firebase của bạn mà không cần thiết bị hợp lệ, nên bạn cần phải giữ bí mật mã thông báo này. Đừng cam kết mã thông báo này với một kho lưu trữ công khai và nếu mã thông báo đã đăng ký bị xâm phạm, hãy thu hồi ngay mã thông báo đó trong bảng điều khiển Firebase.
Trong mã khởi chạy, hãy làm như sau:
usingFirebase.AppCheck;voidInitializeFirebase(){// Configure the Debug Provider factory with your debug token.DebugAppCheckProviderFactory.Instance.SetDebugToken("YOUR DEBUG TOKEN");// Set App Check to use the debug provider factoryFirebaseAppCheck.SetAppCheckProviderFactory(DebugAppCheckProviderFactory.Instance);// Proceed to initialize Firebase as normal}
Các lựa chọn cấu hình khác
Bạn có thể dùng các lựa chọn cấu hình khác dựa trên nền tảng, chẳng hạn như sử dụng các biến môi trường của nền tảng. Để biết thêm thông tin, hãy tham khảo tài liệu về trình cung cấp thông tin gỡ lỗi iOS+ hoặc Android.
Vì mã thông báo này cho phép truy cập vào các tài nguyên Firebase của bạn mà không cần thiết bị hợp lệ, nên bạn cần phải giữ bí mật mã thông báo này. Đừng cam kết với kho lưu trữ công khai và nếu mã thông báo đã đăng ký bị xâm phạm, hãy thu hồi ngay mã thông báo đó trong bảng điều khiển Firebase.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-23 UTC."],[],[],null,["After you have registered your app for App Check, your app normally won't run\non desktop platforms, in an emulator, or from a continuous integration (CI)\nenvironment, since those environments don't qualify as valid devices. If you\nwant to run your app in such an environment during development and testing, you\ncan create a debug build of your app that uses the App Check debug provider\ninstead of a real attestation provider.\n| **Warning:** The debug provider allows access to your Firebase resources from unverified devices. Don't use the debug provider in production builds of your app, and don't share your debug builds with untrusted parties.\n\nConfiguration via code\n\nTo use the debug provider while running your app\n(during development, for example), do the following:\n\n1. In the [**App Check**](//console.firebase.google.com/project/_/appcheck) section\n of the Firebase console, choose **Manage debug tokens** from your app's\n overflow menu. Then, create a new debug token. You'll need the token in the\n next step.\n\n Because this token allows access to your Firebase resources without\n a valid device, it is crucial that you keep it private. Don't commit it to a\n public repository, and if a registered token is ever compromised, revoke it\n immediately in the Firebase console.\n\n2. In your initialization code, do the following:\n\n using Firebase.AppCheck;\n\n void InitializeFirebase() {\n // Configure the Debug Provider factory with your debug token.\n DebugAppCheckProviderFactory.Instance.SetDebugToken(\"YOUR DEBUG TOKEN\");\n\n // Set App Check to use the debug provider factory\n FirebaseAppCheck.SetAppCheckProviderFactory(\n DebugAppCheckProviderFactory.Instance);\n\n // Proceed to initialize Firebase as normal\n }\n\nOther configuration options\n\nOther configuration options are available based on platform, for example using\nthe platforms environment variables. For more\ninformation, refer to the [iOS+](/docs/app-check/ios/debug-provider) or\n[Android](/docs/app-check/android/debug-provider) debug provider documentation.\n\nBecause this token allows access to your Firebase resources without a\nvalid device, it is crucial that you keep it private. Don't commit it to a\npublic repository, and if a registered token is ever compromised, revoke it\nimmediately in the Firebase console."]]