অ্যাপল প্ল্যাটফর্মগুলিতে অ্যাপ চেকের মাধ্যমে কাস্টম ব্যাকএন্ড সংস্থানগুলি সুরক্ষিত করুন
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
আপনি আপনার অ্যাপের জন্য নন-Google কাস্টম ব্যাকএন্ড রিসোর্স, যেমন আপনার নিজের স্ব-হোস্ট করা ব্যাকএন্ড রক্ষা করতে App Check ব্যবহার করতে পারেন। এটি করার জন্য, আপনাকে নিম্নলিখিত উভয়টি করতে হবে:
এই পৃষ্ঠায় বর্ণিত প্রতিটি অনুরোধের সাথে একটি App Check টোকেন পাঠাতে আপনার অ্যাপ ক্লায়েন্টকে পরিবর্তন করুন।
আপনার ব্যাকএন্ড অনুরোধে একটি বৈধ, মেয়াদোত্তীর্ণ, App Check টোকেন অন্তর্ভুক্ত রয়েছে তা নিশ্চিত করতে, প্রতিটি অনুরোধকে AppCheck.token() এ একটি কলে মুড়ে দিন। App Check লাইব্রেরি প্রয়োজনে টোকেনটি রিফ্রেশ করবে এবং আপনি পদ্ধতির সমাপ্তি ব্লকে টোকেনটি অ্যাক্সেস করতে পারবেন।
একবার আপনার কাছে একটি বৈধ টোকেন হয়ে গেলে, আপনার ব্যাকএন্ডে অনুরোধ সহ এটি পাঠান। আপনি কীভাবে এটি সম্পন্ন করবেন তার সুনির্দিষ্ট বিষয়গুলি আপনার উপর নির্ভর করে, কিন্তু ক্যোয়ারী প্যারামিটার সহ URL-এর অংশ হিসাবে App Check টোকেনগুলি পাঠাবেন না , কারণ এটি তাদের দুর্ঘটনাজনিত ফাঁস এবং বাধার জন্য ঝুঁকিপূর্ণ করে তোলে৷ নিম্নলিখিত উদাহরণটি একটি কাস্টম HTTP শিরোনামে টোকেন পাঠায়, যা প্রস্তাবিত পদ্ধতি।
সুইফট
do{lettoken=tryawaitAppCheck.appCheck().token(forcingRefresh:false)// Get the raw App Check token string.lettokenString=token.token// Include the App Check token with requests to your server.leturl=URL(string:"https://yourbackend.example.com/yourApiEndpoint")!varrequest=URLRequest(url:url)request.httpMethod="GET"request.setValue(tokenString,forHTTPHeaderField:"X-Firebase-AppCheck")lettask=URLSession.shared.dataTask(with:request){data,response,errorin// Handle response from your backend.}task.resume()}catch(leterror){print("Unable to retrieve App Check token: \(error)")return}
উদ্দেশ্য-C
[[FIRAppCheckappCheck]tokenForcingRefresh:NOcompletion:^(FIRAppCheckToken*_Nullabletoken,NSError*_Nullableerror){if(error!=nil){// Handle any errors if the token was not retrieved.NSLog(@"Unable to retrieve App Check token: %@",error);return;}if(token==nil){NSLog(@"Unable to retrieve App Check token.");return;}// Get the raw App Check token string.NSString*tokenString=token.token;// Include the App Check token with requests to your server.NSURL*url=[[NSURLalloc]initWithString:@"https://yourbackend.example.com/yourApiEndpoint"];NSMutableURLRequest*request=[[NSMutableURLRequestalloc]initWithURL:url];[requestsetHTTPMethod:@"GET"];[requestsetValue:tokenStringforHTTPHeaderField:@"X-Firebase-AppCheck"];NSURLSessionDataTask*task=[[NSURLSessionsharedSession]dataTaskWithRequest:requestcompletionHandler:^(NSData*_Nullabledata,NSURLResponse*_Nullableresponse,NSError*_Nullableerror){// Handle response from your backend.}];[taskresume];}];
রিপ্লে সুরক্ষা (বিটা)
আপনি যখন রিপ্লে সুরক্ষা সক্ষম করেছেন এমন একটি এন্ডপয়েন্টে একটি অনুরোধ করার সময়, token()limitedUseToken() ) এ কল করে অনুরোধটি মুড়ে দিন:
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-09-03 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["You 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 either [App Attest](/docs/app-check/ios/app-attest-provider),\n[DeviceCheck](/docs/app-check/ios/devicecheck-provider), or a [custom provider](/docs/app-check/ios/custom-provider).\n\nSend App Check tokens with backend requests\n\nTo ensure your backend requests include a valid, unexpired, App Check token,\nwrap each request in a call to `AppCheck.token()`. The App Check library\nwill refresh the token if necessary, and you can access the token in the\nmethod's completion block.\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 following\nexample sends the token in a custom HTTP header, which is the recommended\napproach. \n\nSwift \n\n```swift\ndo {\n let token = try await AppCheck.appCheck().token(forcingRefresh: false)\n\n // Get the raw App Check token string.\n let tokenString = token.token\n\n // Include the App Check token with requests to your server.\n let url = URL(string: \"https://yourbackend.example.com/yourApiEndpoint\")!\n var request = URLRequest(url: url)\n request.httpMethod = \"GET\"\n request.setValue(tokenString, forHTTPHeaderField: \"X-Firebase-AppCheck\")\n\n let task = URLSession.shared.dataTask(with: request) { data, response, error in\n // Handle response from your backend.\n }\n task.resume()\n} catch(let error) {\n print(\"Unable to retrieve App Check token: \\(error)\")\n return\n}\n```\n\nObjective-C \n\n```objective-c\n[[FIRAppCheck appCheck] tokenForcingRefresh:NO\n completion:^(FIRAppCheckToken * _Nullable token,\n NSError * _Nullable error) {\n if (error != nil) {\n // Handle any errors if the token was not retrieved.\n NSLog(@\"Unable to retrieve App Check token: %@\", error);\n return;\n }\n if (token == nil) {\n NSLog(@\"Unable to retrieve App Check token.\");\n return;\n }\n\n // Get the raw App Check token string.\n NSString *tokenString = token.token;\n\n // Include the App Check token with requests to your server.\n NSURL *url = [[NSURL alloc] initWithString:@\"https://yourbackend.example.com/yourApiEndpoint\"];\n NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];\n [request setHTTPMethod:@\"GET\"];\n [request setValue:tokenString forHTTPHeaderField:@\"X-Firebase-AppCheck\"];\n\n NSURLSessionDataTask *task =\n [[NSURLSession sharedSession] dataTaskWithRequest:request\n completionHandler:^(NSData * _Nullable data,\n NSURLResponse * _Nullable response,\n NSError * _Nullable error) {\n // Handle response from your backend.\n }];\n [task resume];\n}];\n```\n\nReplay protection (beta)\n\nWhen making a request to an endpoint for which you've enabled\n[replay protection](/docs/app-check/custom-resource-backend#replay-protection),\nwrap the request in a call to `limitedUseToken()` instead of `token()`: \n\nSwift \n\n AppCheck.appCheck().limitedUseToken() { token, error in\n // ...\n }\n\nObjective-C \n\n [[FIRAppCheck appCheck] limitedUseTokenWithCompletion:^(FIRAppCheckToken * _Nullable token,\n NSError * _Nullable error) {\n // ...\n }];"]]