@@ -380,4 +380,54 @@ TEST_F(FirebaseFunctionsTest, TestFunctionFromURL) {
380380 EXPECT_EQ (result.map ()[" operationResult" ], 6 );
381381}
382382
383+ TEST_F (FirebaseFunctionsTest, TestFunctionWithLimitedUseAppCheckToken) {
384+ SignIn ();
385+
386+ // addNumbers(5, 7) = 12
387+ firebase::Variant data (firebase::Variant::EmptyMap ());
388+ data.map ()[" firstNumber" ] = 5 ;
389+ data.map ()[" secondNumber" ] = 7 ;
390+
391+ firebase::functions::HttpsCallableOptions options;
392+ options.limited_use_app_check_token = true ;
393+
394+ LogDebug (" Calling addNumbers with Limited Use App Check Token" );
395+ firebase::functions::HttpsCallableReference ref =
396+ functions_->GetHttpsCallable (" addNumbers" , options);
397+
398+ firebase::Variant result =
399+ TestFunctionHelper (" addNumbers" , ref, &data, firebase::Variant::Null ())
400+ .result ()
401+ ->data ();
402+ EXPECT_TRUE (result.is_map ());
403+ EXPECT_EQ (result.map ()[" operationResult" ], 12 );
404+ }
405+
406+ TEST_F (FirebaseFunctionsTest, TestFunctionFromURLWithLimitedUseAppCheckToken) {
407+ SignIn ();
408+
409+ // addNumbers(4, 2) = 6
410+ firebase::Variant data (firebase::Variant::EmptyMap ());
411+ data.map ()[" firstNumber" ] = 4 ;
412+ data.map ()[" secondNumber" ] = 2 ;
413+
414+ std::string proj = app_->options ().project_id ();
415+ std::string url =
416+ " https://us-central1-" + proj + " .cloudfunctions.net/addNumbers" ;
417+
418+ firebase::functions::HttpsCallableOptions options;
419+ options.limited_use_app_check_token = true ;
420+
421+ LogDebug (" Calling by URL %s with Limited Use App Check Token" , url.c_str ());
422+ firebase::functions::HttpsCallableReference ref =
423+ functions_->GetHttpsCallableFromURL (url.c_str (), options);
424+
425+ firebase::Variant result =
426+ TestFunctionHelper (url.c_str (), ref, &data, firebase::Variant::Null ())
427+ .result ()
428+ ->data ();
429+ EXPECT_TRUE (result.is_map ());
430+ EXPECT_EQ (result.map ()[" operationResult" ], 6 );
431+ }
432+
383433} // namespace firebase_testapp_automated
0 commit comments