Cloud Functions for Firebase क्लाइंट SDK टूल की मदद से, फ़ंक्शन को सीधे यहां से कॉल किया जा सकता है Firebase ऐप्लिकेशन. अपने ऐप्लिकेशन से इस तरीके से फ़ंक्शन कॉल करने के लिए, लिखें और डिप्लॉय करें Cloud Functions में एचटीटीपी कॉल करने लायक फ़ंक्शन है और इसके बाद, अपने ऐप्लिकेशन से फ़ंक्शन को कॉल करने के लिए क्लाइंट लॉजिक जोड़ें.
यह ध्यान रखना ज़रूरी है कि एचटीटीपी कॉल करने लायक फ़ंक्शन एक जैसे होते हैं, लेकिन यह यूआरएल, एचटीटीपी फ़ंक्शन के जैसा नहीं है. एचटीटीपी कॉल करने लायक फ़ंक्शन का इस्तेमाल करने के लिए अपने प्लैटफ़ॉर्म के लिए क्लाइंट SDK टूल का इस्तेमाल बैकएंड एपीआई (या प्रोटोकॉल लागू करना). कॉलबले, एचटीटीपी फ़ंक्शन से इन मुख्य बातों में अलग होते हैं:
- कॉल किए जा सकने वाले पॉइंट के साथ, Firebase Authentication टोकन, FCM टोकन, और App Check टोकन उपलब्ध होने पर, उन्हें अनुरोधों में अपने-आप शामिल कर लिया जाता है.
- ट्रिगर, अनुरोध बॉडी को अपने-आप डिसीरियलाइज़ करता है और पुष्टि करने वाले टोकन की पुष्टि करता है.
Cloud Functions 2nd gen और उसके बाद के वर्शन के लिए Firebase SDK टूल, इन Firebase क्लाइंट के साथ इंटरऑपरेट करता है एचटीटीपीएस कॉल करने की सुविधा देने वाले फ़ंक्शन के साथ काम करने के लिए, SDK टूल के कम से कम वर्शन:
- Firebase Apple प्लैटफ़ॉर्म के लिए SDK टूल 11.2.0
- Android 21.0.0 के लिए Firebase SDK टूल
- Firebase मॉड्यूलर वेब SDK टूल वर्शन 9.7.0
अगर आपको किसी ऐसे प्लैटफ़ॉर्म पर बने ऐप्लिकेशन में मिलती-जुलती सुविधा जोड़नी है जिस पर यह सुविधा काम नहीं करती, तो https.onCall
के लिए प्रोटोकॉल स्पेसिफ़िकेशन देखें. इस गाइड के बाकी हिस्से में, Apple प्लैटफ़ॉर्म, Android, वेब, C++, और Unity के लिए, एचटीटीपी कॉल किए जा सकने वाले फ़ंक्शन को लिखने, डिप्लॉय करने, और कॉल करने का तरीका बताया गया है.
कॉल करने लायक फ़ंक्शन लिखें और डिप्लॉय करें
इस सेक्शन में दिए गए कोड के उदाहरण, क्विकस्टार्ट सैंपल जो सर्वर-साइड फ़ंक्शन को अनुरोध भेजने और किसी क्लाइंट SDK टूल का इस्तेमाल करके रिस्पॉन्स दिया जाता है. शुरू करने के लिए, ज़रूरी मॉड्यूल इंपोर्ट करें:
Node.js
// Dependencies for callable functions.
const {onCall, HttpsError} = require("firebase-functions/v2/https");
const {logger} = require("firebase-functions/v2");
// Dependencies for the addMessage function.
const {getDatabase} = require("firebase-admin/database");
const sanitizer = require("./sanitizer");
Python
# Dependencies for callable functions.
from firebase_functions import https_fn, options
# Dependencies for writing to Realtime Database.
from firebase_admin import db, initialize_app
अपने प्लैटफ़ॉर्म के लिए अनुरोध हैंडलर का इस्तेमाल करें (functions.https.onCall
)
या on_call
)
एचटीटीपीएस कॉल करने लायक फ़ंक्शन बनाने के लिए. इस तरीके में, अनुरोध पैरामीटर का इस्तेमाल किया जाता है:
Node.js
// Saves a message to the Firebase Realtime Database but sanitizes the
// text by removing swearwords.
exports.addmessage = onCall((request) => {
// ...
});
Python
@https_fn.on_call()
def addmessage(req: https_fn.CallableRequest) -> Any:
"""Saves a message to the Firebase Realtime Database but sanitizes the text
by removing swear words."""
request
पैरामीटर में, क्लाइंट ऐप्लिकेशन से पास किया गया डेटा शामिल होता है. साथ ही, पुष्टि करने की स्थिति जैसा अतिरिक्त कॉन्टेक्स्ट भी होता है. कॉल किए जा सकने वाले ऐसे फ़ंक्शन के लिए जो Realtime Database में टेक्स्ट मैसेज सेव करता है, उदाहरण के लिए, data
में मैसेज का टेक्स्ट हो सकता है. साथ ही, auth
में पुष्टि करने की जानकारी भी हो सकती है:
Node.js
// Message text passed from the client.
const text = request.data.text;
// Authentication / user information is automatically added to the request.
const uid = request.auth.uid;
const name = request.auth.token.name || null;
const picture = request.auth.token.picture || null;
const email = request.auth.token.email || null;
Python
# Message text passed from the client.
text = req.data["text"]
# Authentication / user information is automatically added to the request.
uid = req.auth.uid
name = req.auth.token.get("name", "")
picture = req.auth.token.get("picture", "")
email = req.auth.token.get("email", "")
कॉल किए जा सकने वाले फ़ंक्शन की जगह और कॉल करने वाले क्लाइंट की जगह के बीच की दूरी की वजह से, नेटवर्क में देरी हो सकती है. परफ़ॉर्मेंस को ऑप्टिमाइज़ करने के लिए, उस फ़ंक्शन की जगह की जानकारी दें जहां साथ ही, कॉल करने की जगह की जानकारी को जगह की जानकारी के साथ अलाइन करें SDK टूल को इस्तेमाल करने के दौरान सेट किया जा सकता है आपको क्लाइंट-साइड पर रखना चाहिए.
इसके अलावा, आपके पास App Check को प्रमाणित करने का विकल्प भी है, ताकि गलत इस्तेमाल से जुड़े बैकएंड संसाधन. जैसे, बिलिंग से जुड़ी धोखाधड़ी या फ़िशिंग. यहां जाएं: Cloud Functions के लिए, App Check नीति उल्लंघन ठीक करने का तरीका (एनफ़ोर्समेंट) चालू करें.
नतीजा भेजना
क्लाइंट को डेटा वापस भेजने के लिए, ऐसा डेटा भेजें जिसे JSON कोड में बदला जा सके. इसके लिए उदाहरण के लिए, जोड़ी गई कार्रवाई का नतीजा दिखाने के लिए:
Node.js
// returning result.
return {
firstNumber: firstNumber,
secondNumber: secondNumber,
operator: "+",
operationResult: firstNumber + secondNumber,
};
Python
return {
"firstNumber": first_number,
"secondNumber": second_number,
"operator": "+",
"operationResult": first_number + second_number
}
मैसेज के टेक्स्ट के उदाहरण से हटाया गया टेक्स्ट, क्लाइंट और Realtime Database, दोनों को दिखाया जाता है. Node.js में ऐसा किया जा सकता है JavaScript प्रॉमिस का इस्तेमाल करके:
Node.js
// Saving the new message to the Realtime Database.
const sanitizedMessage = sanitizer.sanitizeText(text); // Sanitize message.
return getDatabase().ref("/messages").push({
text: sanitizedMessage,
author: {uid, name, picture, email},
}).then(() => {
logger.info("New Message written");
// Returning the sanitized message to the client.
return {text: sanitizedMessage};
})
Python
# Saving the new message to the Realtime Database.
sanitized_message = sanitize_text(text) # Sanitize message.
db.reference("/messages").push({ # type: ignore
"text": sanitized_message,
"author": {
"uid": uid,
"name": name,
"picture": picture,
"email": email
}
})
print("New message written")
# Returning the sanitized message to the client.
return {"text": sanitized_message}
सीओआरएस कॉन्फ़िगर करें (क्रॉस-ऑरिजिन रिसॉर्स शेयरिंग)
cors
विकल्प का इस्तेमाल करके, यह कंट्रोल करें कि कौनसे ऑरिजिन आपके फ़ंक्शन को ऐक्सेस कर सकते हैं.
डिफ़ॉल्ट रूप से, कॉल किए जा सकने वाले फ़ंक्शन में सीओआरएस कॉन्फ़िगर किया जाता है, ताकि सभी ऑरिजिन से अनुरोध किए जा सकें. कुछ क्रॉस-ऑरिजिन अनुरोधों को अनुमति देने के लिए, उन खास डोमेन या रेगुलर एक्सप्रेशन की सूची दें जिन्हें अनुमति दी जानी चाहिए. उदाहरण के लिए:
Node.js
const { onCall } = require("firebase-functions/v2/https");
exports.getGreeting = onCall(
{ cors: [/firebase\.com$/, "https://flutter.com"] },
(request) => {
return "Hello, world!";
}
);
क्रॉस-ऑरिजिन अनुरोधों पर पाबंदी लगाने के लिए, cors
नीति को false
पर सेट करें.
गड़बड़ियां ठीक करना
यह पक्का करने के लिए कि क्लाइंट को गड़बड़ी की काम की जानकारी मिले, functions.https.HttpsError
या https_fn.HttpsError
के किसी इंस्टेंस को फेंककर (या Node.js के लिए, अस्वीकार किए गए प्रॉमिस को दिखाकर) कॉल किए जा सकने वाले फ़ंक्शन से गड़बड़ियां दिखाएं.
गड़बड़ी में code
एट्रिब्यूट है, जो gRPC में दी गई वैल्यू में से एक हो सकती है
स्टेटस कोड.
गड़बड़ियों में एक स्ट्रिंग message
भी होती है, जो डिफ़ॉल्ट रूप से खाली स्ट्रिंग होती है. इनमें वैकल्पिक details
फ़ील्ड भी हो सकता है, जिसमें अपनी पसंद के मुताबिक वैल्यू डाली जा सकती है. अगर आपके फ़ंक्शन से एचटीटीपीएस गड़बड़ी के अलावा कोई और गड़बड़ी मिलती है,
इसके बजाय, आपके क्लाइंट को मैसेज INTERNAL
और कोड की गड़बड़ी मिलती है
internal
.
उदाहरण के लिए, कोई फ़ंक्शन, डेटा की पुष्टि और पुष्टि करने से जुड़ी गड़बड़ियां दिखा सकता है कॉल करने वाले क्लाइंट के पास वापस जाने के लिए गड़बड़ी के मैसेज दिखेंगे:
Node.js
// Checking attribute.
if (!(typeof text === "string") || text.length === 0) {
// Throwing an HttpsError so that the client gets the error details.
throw new HttpsError("invalid-argument", "The function must be called " +
"with one arguments \"text\" containing the message text to add.");
}
// Checking that the user is authenticated.
if (!request.auth) {
// Throwing an HttpsError so that the client gets the error details.
throw new HttpsError("failed-precondition", "The function must be " +
"called while authenticated.");
}
Python
# Checking attribute.
if not isinstance(text, str) or len(text) < 1:
# Throwing an HttpsError so that the client gets the error details.
raise https_fn.HttpsError(code=https_fn.FunctionsErrorCode.INVALID_ARGUMENT,
message=('The function must be called with one argument, "text",'
" containing the message text to add."))
# Checking that the user is authenticated.
if req.auth is None:
# Throwing an HttpsError so that the client gets the error details.
raise https_fn.HttpsError(code=https_fn.FunctionsErrorCode.FAILED_PRECONDITION,
message="The function must be called while authenticated.")
कॉल करने लायक फ़ंक्शन को डिप्लॉय करें
index.js
में, कॉल किया जा सकने वाला फ़ंक्शन सेव करने के बाद, firebase deploy
को चलाने पर, उसे अन्य सभी फ़ंक्शन के साथ डिप्लॉय किया जाता है.
सिर्फ़ कॉल किए जा सकने वाले फ़ंक्शन को डिप्लॉय करने के लिए, --only
आर्ग्युमेंट का इस्तेमाल करें, जैसा कि कुछ हिस्से को डिप्लॉय करने के लिए दिखाया गया है:
firebase deploy --only functions:addMessage
अगर फ़ंक्शन डिप्लॉय करते समय अनुमतियों से जुड़ी गड़बड़ियां होती हैं, तो पक्का करें कि आईएएम की भूमिकाएं डिप्लॉयमेंट कमांड चलाने वाले उपयोगकर्ता को असाइन किया गया है.
अपना क्लाइंट डेवलपमेंट एनवायरमेंट सेट अप करना
पक्का करें कि आपने सभी ज़रूरी शर्तें पूरी कर ली हों. इसके बाद, अपने ऐप्लिकेशन में ज़रूरी डिपेंडेंसी और क्लाइंट लाइब्रेरी जोड़ें.
iOS और उसके बाद के वर्शन
अपने Apple ऐप्लिकेशन में Firebase जोड़ने के लिए निर्देशों का पालन करें.
Firebase डिपेंडेंसी इंस्टॉल और मैनेज करने के लिए, Swift पैकेज मैनेजर का इस्तेमाल करें.
- Xcode में, अपना ऐप्लिकेशन प्रोजेक्ट खोलकर, फ़ाइल > पैकेज जोड़ें पर जाएं.
- जब कहा जाए, तब Firebase Apple प्लैटफ़ॉर्म SDK टूल का रिपॉज़िटरी जोड़ें:
- Cloud Functions लाइब्रेरी चुनें.
- अपने टारगेट की बिल्ड सेटिंग के अन्य लिंकर फ़्लैग सेक्शन में
-ObjC
फ़्लैग जोड़ें. - प्रोसेस पूरी होने के बाद, Xcode बैकग्राउंड में आपकी डिपेंडेंसी को अपने-आप हल और डाउनलोड करना शुरू कर देगा.
https://github.com/firebase/firebase-ios-sdk.git
Web
- अपने वेब ऐप्लिकेशन में Firebase जोड़ने के लिए, निर्देशों का पालन करें. अपने टर्मिनल से यह कमांड ज़रूर चलाएं:
npm install firebase@10.13.2 --save
Firebase कोर और Cloud Functions, दोनों को मैन्युअल तरीके से ज़रूरी बनाएं:
import { initializeApp } from 'firebase/app'; import { getFunctions } from 'firebase/functions'; const app = initializeApp({ projectId: '### CLOUD FUNCTIONS PROJECT ID ###', apiKey: '### FIREBASE API KEY ###', authDomain: '### FIREBASE AUTH DOMAIN ###', }); const functions = getFunctions(app);
Android
अपने Android ऐप्लिकेशन में Firebase जोड़ने के लिए, निर्देशों का पालन करें.
आपके मॉड्यूल (ऐप्लिकेशन-लेवल) की Gradle फ़ाइल में (आम तौर पर
<project>/<app-module>/build.gradle.kts
या<project>/<app-module>/build.gradle
), Android के लिए Cloud Functions लाइब्रेरी के लिए डिपेंडेंसी जोड़ें. हमारा सुझाव है कि Firebase Android BoM लाइब्रेरी के वर्शन को कंट्रोल करने के लिए.dependencies { // Import the BoM for the Firebase platform implementation(platform("com.google.firebase:firebase-bom:33.3.0")) // Add the dependency for the Cloud Functions library // When using the BoM, you don't specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-functions") }
Firebase Android BoM का इस्तेमाल करने पर, आपका ऐप्लिकेशन हमेशा Firebase Android लाइब्रेरी के काम करने वाले वर्शन का इस्तेमाल करेगा.
(वैकल्पिक) BoM का इस्तेमाल करके, बिना Firebase लाइब्रेरी डिपेंडेंसी जोड़ें
अगर आपको Firebase BoM का इस्तेमाल नहीं करना है, तो आपको Firebase लाइब्रेरी का हर वर्शन बताना होगा इसकी डिपेंडेंसी लाइन में.
ध्यान दें कि अगर आप अपने ऐप्लिकेशन में कई Firebase लाइब्रेरी का इस्तेमाल करते हैं, तो हम लाइब्रेरी वर्शन को मैनेज करने के लिए, BoM का इस्तेमाल करने की सलाह दी जाती है. इससे यह पक्का होता है कि सभी वर्शन साथ काम करता है.
dependencies { // Add the dependency for the Cloud Functions library // When NOT using the BoM, you must specify versions in Firebase library dependencies implementation("com.google.firebase:firebase-functions:21.0.0") }
क्लाइंट SDK टूल शुरू करें
Cloud Functions का इंस्टेंस शुरू करना:
Swift
lazy var functions = Functions.functions()
Objective-C
@property(strong, nonatomic) FIRFunctions *functions;
// ...
self.functions = [FIRFunctions functions];
Web
const app = initializeApp({
projectId: '### CLOUD FUNCTIONS PROJECT ID ###',
apiKey: '### FIREBASE API KEY ###',
authDomain: '### FIREBASE AUTH DOMAIN ###',
});
const functions = getFunctions(app);
Kotlin+KTX
private lateinit var functions: FirebaseFunctions // ... functions = Firebase.functions
Java
private FirebaseFunctions mFunctions; // ... mFunctions = FirebaseFunctions.getInstance();
फ़ंक्शन को कॉल करना
Swift
functions.httpsCallable("addMessage").call(["text": inputField.text]) { result, error in
if let error = error as NSError? {
if error.domain == FunctionsErrorDomain {
let code = FunctionsErrorCode(rawValue: error.code)
let message = error.localizedDescription
let details = error.userInfo[FunctionsErrorDetailsKey]
}
// ...
}
if let data = result?.data as? [String: Any], let text = data["text"] as? String {
self.resultField.text = text
}
}
Objective-C
[[_functions HTTPSCallableWithName:@"addMessage"] callWithObject:@{@"text": _inputField.text}
completion:^(FIRHTTPSCallableResult * _Nullable result, NSError * _Nullable error) {
if (error) {
if ([error.domain isEqual:@"com.firebase.functions"]) {
FIRFunctionsErrorCode code = error.code;
NSString *message = error.localizedDescription;
NSObject *details = error.userInfo[@"details"];
}
// ...
}
self->_resultField.text = result.data[@"text"];
}];
Web
var addMessage = firebase.functions().httpsCallable('addMessage');
addMessage({ text: messageText })
.then((result) => {
// Read result of the Cloud Function.
var sanitizedMessage = result.data.text;
});
Web
import { getFunctions, httpsCallable } from "firebase/functions";
const functions = getFunctions();
const addMessage = httpsCallable(functions, 'addMessage');
addMessage({ text: messageText })
.then((result) => {
// Read result of the Cloud Function.
/** @type {any} */
const data = result.data;
const sanitizedMessage = data.text;
});
Kotlin+KTX
private fun addMessage(text: String): Task<String> { // Create the arguments to the callable function. val data = hashMapOf( "text" to text, "push" to true, ) return functions .getHttpsCallable("addMessage") .call(data) .continueWith { task -> // This continuation runs on either success or failure, but if the task // has failed then result will throw an Exception which will be // propagated down. val result = task.result?.data as String result } }
Java
private Task<String> addMessage(String text) { // Create the arguments to the callable function. Map<String, Object> data = new HashMap<>(); data.put("text", text); data.put("push", true); return mFunctions .getHttpsCallable("addMessage") .call(data) .continueWith(new Continuation<HttpsCallableResult, String>() { @Override public String then(@NonNull Task<HttpsCallableResult> task) throws Exception { // This continuation runs on either success or failure, but if the task // has failed then getResult() will throw an Exception which will be // propagated down. String result = (String) task.getResult().getData(); return result; } }); }
Dart
final result = await FirebaseFunctions.instance.httpsCallable('addMessage').call(
{
"text": text,
"push": true,
},
);
_response = result.data as String;
C++
firebase::Future<firebase::functions::HttpsCallableResult> AddMessage(
const std::string& text) {
// Create the arguments to the callable function.
firebase::Variant data = firebase::Variant::EmptyMap();
data.map()["text"] = firebase::Variant(text);
data.map()["push"] = true;
// Call the function and add a callback for the result.
firebase::functions::HttpsCallableReference doSomething =
functions->GetHttpsCallable("addMessage");
return doSomething.Call(data);
}
Unity
private Task<string> addMessage(string text) {
// Create the arguments to the callable function.
var data = new Dictionary<string, object>();
data["text"] = text;
data["push"] = true;
// Call the function and extract the operation from the result.
var function = functions.GetHttpsCallable("addMessage");
return function.CallAsync(data).ContinueWith((task) => {
return (string) task.Result.Data;
});
}
क्लाइंट से जुड़ी गड़बड़ियों को ठीक करना
क्लाइंट को गड़बड़ी की सूचना मिलती है, अगर सर्वर की वजह से कोई गड़बड़ी होती है या इस प्रॉमिस को अस्वीकार कर दिया गया.
अगर फ़ंक्शन से मिली गड़बड़ी function.https.HttpsError
टाइप की है, तो क्लाइंट को सर्वर से गड़बड़ी code
, message
, और details
मिलती है. ऐसा न होने पर, गड़बड़ी में मैसेज INTERNAL
और कोड INTERNAL
शामिल होता है. कैसे काम करता है, इस बारे में जानने के लिए दिशा-निर्देश देखें
कॉल किए जा सकने वाले फ़ंक्शन में गड़बड़ियों को ठीक करने के लिए किया जा सकता है.
Swift
if let error = error as NSError? {
if error.domain == FunctionsErrorDomain {
let code = FunctionsErrorCode(rawValue: error.code)
let message = error.localizedDescription
let details = error.userInfo[FunctionsErrorDetailsKey]
}
// ...
}
Objective-C
if (error) {
if ([error.domain isEqual:@"com.firebase.functions"]) {
FIRFunctionsErrorCode code = error.code;
NSString *message = error.localizedDescription;
NSObject *details = error.userInfo[@"details"];
}
// ...
}
Web
var addMessage = firebase.functions().httpsCallable('addMessage');
addMessage({ text: messageText })
.then((result) => {
// Read result of the Cloud Function.
var sanitizedMessage = result.data.text;
})
.catch((error) => {
// Getting the Error details.
var code = error.code;
var message = error.message;
var details = error.details;
// ...
});
Web
import { getFunctions, httpsCallable } from "firebase/functions";
const functions = getFunctions();
const addMessage = httpsCallable(functions, 'addMessage');
addMessage({ text: messageText })
.then((result) => {
// Read result of the Cloud Function.
/** @type {any} */
const data = result.data;
const sanitizedMessage = data.text;
})
.catch((error) => {
// Getting the Error details.
const code = error.code;
const message = error.message;
const details = error.details;
// ...
});
Kotlin+KTX
addMessage(inputMessage) .addOnCompleteListener { task -> if (!task.isSuccessful) { val e = task.exception if (e is FirebaseFunctionsException) { val code = e.code val details = e.details } } }
Java
addMessage(inputMessage) .addOnCompleteListener(new OnCompleteListener<String>() { @Override public void onComplete(@NonNull Task<String> task) { if (!task.isSuccessful()) { Exception e = task.getException(); if (e instanceof FirebaseFunctionsException) { FirebaseFunctionsException ffe = (FirebaseFunctionsException) e; FirebaseFunctionsException.Code code = ffe.getCode(); Object details = ffe.getDetails(); } } } });
Dart
try {
final result =
await FirebaseFunctions.instance.httpsCallable('addMessage').call();
} on FirebaseFunctionsException catch (error) {
print(error.code);
print(error.details);
print(error.message);
}
C++
void OnAddMessageCallback(
const firebase::Future<firebase::functions::HttpsCallableResult>& future) {
if (future.error() != firebase::functions::kErrorNone) {
// Function error code, will be kErrorInternal if the failure was not
// handled properly in the function call.
auto code = static_cast<firebase::functions::Error>(future.error());
// Display the error in the UI.
DisplayError(code, future.error_message());
return;
}
const firebase::functions::HttpsCallableResult* result = future.result();
firebase::Variant data = result->data();
// This will assert if the result returned from the function wasn't a string.
std::string message = data.string_value();
// Display the result in the UI.
DisplayResult(message);
}
// ...
// ...
auto future = AddMessage(message);
future.OnCompletion(OnAddMessageCallback);
// ...
Unity
addMessage(text).ContinueWith((task) => {
if (task.IsFaulted) {
foreach (var inner in task.Exception.InnerExceptions) {
if (inner is FunctionsException) {
var e = (FunctionsException) inner;
// Function error code, will be INTERNAL if the failure
// was not handled properly in the function call.
var code = e.ErrorCode;
var message = e.ErrorMessage;
}
}
} else {
string result = task.Result;
}
});
सुझाया गया: App Check का गलत इस्तेमाल रोकें
अपने ऐप्लिकेशन को लॉन्च करने से पहले, आपको App Check को चालू करना होगा ताकि यह पक्का किया जा सके कि कॉल करने लायक फ़ंक्शन के एंडपॉइंट सिर्फ़ आपके ऐप्लिकेशन ऐक्सेस कर सकें.