I am trying to write an auth blocking function to prevent users creating accounts from the client side in google identity platform. I have written it in typescript but I am struggling to deploy it
Here is a the website about the blocking functions https://cloud.google.com/identity-platform/docs/blocking-functions
My actual function looks like this
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
import * as gcipCloudFunctions from 'gcip-cloud-functions';
const authClient = new gcipCloudFunctions.Auth();
exports.beforeCreateBlockingFunction = authClient.functions().beforeCreateHandler((user, context) => {
throw new gcipCloudFunctions.https.HttpsError('invalid-argument', `Unauthorized email "${user.email}"`);
});
Have I got the method signature correct?
I am trying to deploy it using the following command. I am not sure whether this works with typescript. Is this the correct way?
// Http trigger with Cloud Functions.
// gcloud functions deploy beforeCreateBlockingFunction --runtime nodejs10 --region europe-west1 --trigger-http --allow-unauthenticated
Any help is appreciated. Kind regards