Unity 프로젝트에서 앱 체크로 커스텀 백엔드 리소스 보호
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
App Check를 사용하여 자체 호스팅 백엔드와 같이 앱의 Google 외 커스텀 백엔드 리소스를 보호할 수 있습니다. 이렇게 하려면 다음 두 가지 작업을 모두 수행해야 합니다.
- 이 페이지에 설명된 대로 각 요청에 따라 앱 체크 토큰을 백엔드로 보내도록 앱 클라이언트를 수정합니다.
- 커스텀 백엔드에서 앱 체크 토큰 확인에 설명된 대로 모든 요청에 유효한 앱 체크 토큰을 요구하도록 백엔드를 수정합니다.
시작하기 전에
기본 제공자를 사용하여 앱에 앱 체크를 추가합니다.
백엔드 요청으로 앱 체크 토큰 전송
백엔드 요청에 만료되지 않은 유효한 앱 체크 토큰이 포함되도록 하려면 각 요청 앞에 FirebaseAppCheck.GetAppCheckTokenAsync()
호출을 추가합니다.
필요한 경우 앱 체크 라이브러리가 토큰을 새로고침합니다.
유효한 토큰이 있으면 요청과 함께 백엔드에 전송합니다. 이 작업을 실행하는 방법은 개발자에게 달려 있지만, 쿼리 매개변수에 포함되는 URL의 일부로 앱 체크 토큰을 전송해서는 안 됩니다. 실수로 인한 유출 및 가로채기에 취약하기 때문입니다. 커스텀 HTTP 헤더에서 토큰을 전송하는 것이 좋습니다.
예를 들면 다음과 같습니다.
void CallApiExample() {
FirebaseAppCheck.DefaultInstance.GetAppCheckToken(false).
ContinueWithOnMainThread(task => {
if (!task.IsFaulted) {
// Got a valid App Check token. Include it in your own http calls.
}
});
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-24(UTC)
[null,null,["최종 업데이트: 2025-08-24(UTC)"],[],[],null,["\u003cbr /\u003e\n\nYou can use App Check to protect non-Google custom backend resources for\nyour app, like your own self-hosted backend. To do so, you'll need to do both of\nthe following:\n\n- Modify your app client to send an App Check token along with each request to your backend, as described on this page.\n- Modify your backend to require a valid App Check token with every request, as described in [Verify App Check tokens from a custom backend](/docs/app-check/custom-resource-backend).\n\nBefore you begin\n\nAdd App Check to your app, using the [default providers](/docs/app-check/unity/default-providers).\n\nSend App Check tokens with backend requests\n\nTo ensure your backend requests include a valid, unexpired, App Check token,\nprecede each request with a call to `FirebaseAppCheck.GetAppCheckTokenAsync()`.\nThe App Check library will refresh the token if necessary.\n\nOnce you have a valid token, send it along with the request to your backend. The\nspecifics of how you accomplish this are up to you, but *don't send\nApp Check tokens as part of URLs*, including in query parameters, as this\nmakes them vulnerable to accidental leakage and interception. The recommended\napproach is to send the token in a custom HTTP header.\n\nFor example: \n\n void CallApiExample() {\n FirebaseAppCheck.DefaultInstance.GetAppCheckToken(false).\n ContinueWithOnMainThread(task =\u003e {\n if (!task.IsFaulted) {\n // Got a valid App Check token. Include it in your own http calls.\n }\n });\n }"]]