From e52d62a1064b08b62f0dcf508a9677f6a7396e11 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Mon, 25 Sep 2023 00:40:42 +0530 Subject: [PATCH] add cors --- cloud-functions/python/functions/clearusers.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cloud-functions/python/functions/clearusers.py b/cloud-functions/python/functions/clearusers.py index ef915d4..5ad88f1 100644 --- a/cloud-functions/python/functions/clearusers.py +++ b/cloud-functions/python/functions/clearusers.py @@ -15,6 +15,20 @@ def clear_users(request): Response object using `make_response` . """ + if request.method == 'OPTIONS': + headers = { + 'Access-Control-Allow-Origin': '*', + 'Access-Control-Allow-Methods': 'GET', + 'Access-Control-Allow-Headers': 'Content-Type', + # 'Access-Control-Max-Age': '3600' + } + + return ('', 204, headers) + + headers = { + 'Access-Control-Allow-Origin': '*' + } + key_path = os.getcwd() + '/hpos-preprod-firebase-adminsdk-d6jjt-ae42ad0f67.json' cred = credentials.Certificate(key_path) firebase_admin.initialize_app(cred)