مهم : از 1 مه 2024 ، اپل برای برنامههای iOS که از SDKهای متداول استفاده میکنند، از جمله GoogleSignIn-iOS، به مانیفستهای حریم خصوصی و امضا نیاز دارد . قبل از 1 مه 2024 به GoogleSignIn-iOS نسخه 7.1.0+ ارتقا دهید. راهنمای ارتقاء ما را دنبال کنید.
از App Check با ارائه دهنده اشکال زدایی استفاده کنید
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
اگر بعد از اینکه برنامه خود را برای بررسی برنامه ثبت کردید، می خواهید برنامه خود را در محیطی اجرا کنید که App Check معمولاً آن را معتبر طبقه بندی نمی کند، مانند شبیه ساز در حین توسعه، یا از یک محیط یکپارچه سازی مداوم (CI)، می توانید یک ساختار اشکال زدایی از برنامه خود ایجاد کنید که به جای App Attest از ارائه دهنده اشکال زدایی App Check استفاده می کند.
از ارائه دهنده اشکال زدایی در شبیه ساز استفاده کنید
برای استفاده از ارائه دهنده اشکال زدایی در حین اجرای برنامه خود در یک شبیه ساز به صورت تعاملی (مثلاً در حین توسعه)، موارد زیر را انجام دهید:
کلید iOS API را برای پروژه خود در صفحه اعتبارنامه ها در بخش APIs & Services کنسول Google Cloud جستجو کنید.
در ساخت اشکالزدایی، App Check را برای استفاده از ارائهدهنده اشکالزدایی پیکربندی کنید. باید کلید API را که در مرحله قبل گرفتید مشخص کنید.
#iftargetEnvironment(simulator)GIDSignIn.sharedInstance.configureDebugProvider(withAPIKey:apiKey){errorinifleterror{print("Error configuring `GIDSignIn` for App Check: \(error)")}}#else// Configure App Check for production.#endif
برنامه را راه اندازی کنید. هنگامی که SDK سعی می کند درخواستی را به باطن ارسال کند، یک نشانه اشکال زدایی محلی در کنسول Xcode ثبت می شود. به عنوان مثال:
در بخش بررسی برنامه کنسول Firebase، مدیریت نشانههای اشکال زدایی را از منوی سرریز برنامه خود انتخاب کنید. سپس، رمز اشکال زدایی را که در مرحله قبل وارد کرده اید، ثبت کنید.
پس از ثبت توکن، نقاط پایانی OAuth 2.0 Google آن را برای پروژه شما معتبر میپذیرد.
از آنجایی که این توکن امکان دسترسی به نقاط پایانی auth شما را بدون دستگاه معتبر فراهم می کند، مهم است که آن را خصوصی نگه دارید. آن را به یک مخزن عمومی متعهد نکنید و اگر یک توکن ثبت شده در معرض خطر قرار گرفت، بلافاصله آن را در کنسول Firebase لغو کنید.
از ارائه دهنده اشکال زدایی در یک محیط CI استفاده کنید
برای استفاده از ارائه دهنده اشکال زدایی در محیط یکپارچه سازی پیوسته (CI)، موارد زیر را انجام دهید:
در بخش بررسی برنامه کنسول Firebase، مدیریت نشانههای اشکال زدایی را از منوی سرریز برنامه خود انتخاب کنید. سپس، یک نشانه اشکال زدایی جدید ایجاد کنید. در مرحله بعدی به نشانه نیاز دارید.
از آنجایی که این توکن امکان دسترسی به نقاط پایانی auth شما را بدون دستگاه معتبر فراهم می کند، مهم است که آن را خصوصی نگه دارید. آن را به یک مخزن عمومی متعهد نکنید و اگر یک توکن ثبت شده در معرض خطر قرار گرفت، بلافاصله آن را در کنسول Firebase لغو کنید.
نشانه اشکال زدایی را که به تازگی ایجاد کرده اید به فروشگاه کلید ایمن سیستم CI خود اضافه کنید (به عنوان مثال، اسرار رمزگذاری شده GitHub Actions یا متغیرهای رمزگذاری شده Travis CI).
در صورت لزوم، سیستم CI خود را به گونه ای پیکربندی کنید که رمز اشکال زدایی خود را در محیط CI به عنوان یک متغیر محیطی در دسترس قرار دهد. نام متغیر را چیزی مانند APP_CHECK_DEBUG_TOKEN_FROM_CI بگذارید.
در Xcode، یک متغیر محیطی با نام FIRAAppCheckDebugToken و چیزی شبیه $(APP_CHECK_DEBUG_TOKEN) به طرح آزمایشی خود اضافه کنید.
اسکریپت آزمایشی CI خود را پیکربندی کنید تا رمز اشکال زدایی را به عنوان یک متغیر محیطی ارسال کند. به عنوان مثال:
xcodebuild test -scheme YourTestScheme -workspace YourProject.xcworkspace \
APP_CHECK_DEBUG_TOKEN=$(APP_CHECK_DEBUG_TOKEN_FROM_CI)
کلید iOS API را برای پروژه خود در صفحه اعتبارنامه ها در بخش APIs & Services کنسول Google Cloud جستجو کنید.
در ساخت اشکالزدایی، App Check را برای استفاده از ارائهدهنده اشکالزدایی پیکربندی کنید. باید کلید API را که در مرحله قبل گرفتید مشخص کنید.
#iftargetEnvironment(simulator)GIDSignIn.sharedInstance.configureDebugProvider(withAPIKey:apiKey){errorinifleterror{print("Error configuring `GIDSignIn` for App Check: \(error)")}}#else// Configure App Check for production.#endif
هنگامی که برنامه شما در یک محیط CI اجرا می شود، نقاط پایانی OAuth 2.0 Google رمز ارسالی را به عنوان معتبر برای پروژه شما می پذیرد.
تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-25 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThe App Check debug provider enables app functionality in test environments like simulators and CI, bypassing the usual App Check verifications.\u003c/p\u003e\n"],["\u003cp\u003eFor simulator use, configure your debug build with the debug provider, obtain a debug token from the Xcode console, and register it in the Firebase console.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the debug provider in a CI environment, create a debug token in the Firebase console, store it securely in your CI system, and configure your CI test script to use it.\u003c/p\u003e\n"],["\u003cp\u003e\u003cstrong\u003eImportant:\u003c/strong\u003e The debug provider bypasses security measures; therefore, debug tokens should be kept confidential and never used in production builds.\u003c/p\u003e\n"]]],[],null,["# Use App Check with the debug provider\n\nIf, after you have registered your app for App Check, you want to run your\napp in an environment that App Check would normally not classify as valid,\nsuch as a simulator during development, or from a continuous integration (CI)\nenvironment, you can create a debug build of your app that uses the\nApp Check debug provider instead of App Attest.\n\n\u003cbr /\u003e\n\n| **Firebase users**: You must follow the steps on this page to configure Google Sign-in to use the App Check debug provider, even if you've already configured Firebase services to use the App Check debug provider.\n\n\u003cbr /\u003e\n\n| **Warning:** The debug provider allows access to your project's auth endpoints from unverified devices. **Don't** use the debug provider in production builds of your app, and be careful not to leak your debug token.\n\nUse the debug provider in a simulator\n-------------------------------------\n\nTo use the debug provider while running your app in a simulator interactively\n(during development, for example), do the following:\n\n1. Look up the iOS API key for your project on the [Credentials](https://console.cloud.google.com/apis/credentials?project=_)\n page of the **APIs \\& Services** section of the Google Cloud console.\n\n2. In your debug build, configure App Check to use the debug provider. You'll\n need to specify the API key you got in the previous step.\n\n #if targetEnvironment(simulator)\n GIDSignIn.sharedInstance.configureDebugProvider(withAPIKey: apiKey) { error in\n if let error {\n print(\"Error configuring `GIDSignIn` for App Check: \\(error)\")\n }\n }\n #else\n // Configure App Check for production.\n #endif\n\n3. Launch the app. A local debug token will be logged to the Xcode console when\n the SDK tries to send a request to the backend. For example:\n\n \u003cWarning\u003e [AppCheckCore][I-GAC004001] App Check debug token:\n '123a4567-b89c-12d3-e456-789012345678'.\n\n4. In the [App Check](https://console.firebase.google.com/project/_/appcheck) section\n of the Firebase console, choose **Manage debug tokens** from your app's\n overflow menu. Then, register the debug token you logged in the previous\n step.\n\nAfter you register the token, Google's OAuth 2.0 endpoints will accept it as\nvalid for your project.\n\nBecause this token allows access to your auth endpoints 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.\n\nUse the debug provider in a CI environment\n------------------------------------------\n\nTo use the debug provider in a continuous integration (CI) environment, do the\nfollowing:\n\n1. In the [App Check](https://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 auth endpoints 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. Add the debug token you just created to your CI system's secure key store\n (for example, GitHub Actions' [encrypted secrets](https://docs.github.com/en/actions/reference/encrypted-secrets)\n or Travis CI's [encrypted variables](https://docs.travis-ci.com/user/environment-variables/#defining-encrypted-variables-in-travisyml)).\n\n3. If necessary, configure your CI system to make your debug token available\n within the CI environment as an environment variable. Name the variable\n something like `APP_CHECK_DEBUG_TOKEN_FROM_CI`.\n\n4. In Xcode, add an environment variable to your testing scheme with the name\n `FIRAAppCheckDebugToken` and something like `$(APP_CHECK_DEBUG_TOKEN)` as\n the value.\n\n5. Configure your CI test script to pass the debug token as an environment\n variable. For example:\n\n ```\n xcodebuild test -scheme YourTestScheme -workspace YourProject.xcworkspace \\\n APP_CHECK_DEBUG_TOKEN=$(APP_CHECK_DEBUG_TOKEN_FROM_CI)\n ```\n6. Look up the iOS API key for your project on the [Credentials](https://console.cloud.google.com/apis/credentials?project=_)\n page of the **APIs \\& Services** section of the Google Cloud console.\n\n7. In your debug build, configure App Check to use the debug provider. You'll\n need to specify the API key you got in the previous step.\n\n #if targetEnvironment(simulator)\n GIDSignIn.sharedInstance.configureDebugProvider(withAPIKey: apiKey) { error in\n if let error {\n print(\"Error configuring `GIDSignIn` for App Check: \\(error)\")\n }\n }\n #else\n // Configure App Check for production.\n #endif\n\nWhen your app runs in a CI environment, Google's OAuth 2.0 endpoints will accept\nthe token it sends as valid for your project."]]