The best way is to deploy a private function.
- When you deploy your function with the cli use the
--no-allow-unauthenticated
param. This feature is in Beta
- On the console, you can't you when you deploy your function. However, you can delete the access to all user in the functions list page
- Click on the function line (not the name of the function, the line)
- Show the info panel in the upper right corner
- Delete
allUsers
from the cloud function invoker.

Now authorize only AppEngine to access to your function
- In the console, at the same place (Function Invoker), add the AppEngine default service account : @appspot.gserviceaccount.com
- With the cli, use this command
gcloud beta functions add-iam-policy-binding <Your Function Name> \
--member='serviceAccount:<your project id>@appspot.gserviceaccount.com' \
--role='roles/cloudfunctions.invoker'
Now only the user/service account with the role cloudfunctions.invoker
could invoke your function.