I tried using firebase cloud functions oncall method directly from my FLUTTER app and it keeps giving me an UNAUTHENTICATED error even when I am logged in Flutter app code
CloudFunctions function = CloudFunctions.instance;
final HttpsCallable createCallable = function.getHttpsCallable(functionName: 'two_create')
..timeout = const Duration(seconds: 30);
try {
final HttpsCallableResult result = await createCallable.call({
'stay': 'con50',
'open': false
});
print(result.data);
}on CloudFunctionsException catch(e){
print('-----------------------------------------------');
print(e.code); print(e.message); print(e.details);
print('-----------------------------------------------');
}
dynamic user = await FirebaseAuth.instance.currentUser();
print(user.uid);
I got this error
I/flutter (19466): -----------------------------------------------
I/flutter (19466): UNAUTHENTICATED
I/flutter (19466): UNAUTHENTICATED
I/flutter (19466): null
I/flutter (19466): -----------------------------------------------
I/flutter (19466): eMTX6OcYPOSeYdimmCSqjbnnmWM2
I tried printing out the uid to show I am currently signed in and I am currently using an android device for testing.
This is the function I am calling from my app
exports.two_create = functions.https.onCall(async (context,data)=>{
var oncall = require('./httponcall');
var text = await oncall.create(admin,allRef.one2,context,data);
return text;
})
And I didn't get any logs from Firebase console when it was triggered