Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

137
Views
callable cloud function on firebase blocked by cors policy

in my project I have to call a cloud function:

if (admin.apps.length === 0) {
  admin.initializeApp();
}
    exports.addCustomClaim = functions.https.onCall((data) => {
      return admin.auth().getUserByEmail(data.email).then((user) => {
        return admin.auth().setCustomUserClaims(user.uid, data.claim).then(() => {
          return {
            message: ` Success!claim ${Object.keys(data.claim)} 
            as been set on ${data.email}`,
          };
        }).catch((err) => {
          return {error: err, data: data};
        });
      });
    });

this is how I call the function:

addCustomClaim(data:{email:string, claims:{}}){
    console.log("setting claims",data.claims)
    const functions = getFunctions()
    const addAdminRole = httpsCallable(functions,'addAdminRole')
    const addCustomClaims = httpsCallable(functions,'addCustomClaims')
    return addCustomClaims({email: data.email, claims: data.claims})
   }

this is the error:

Access to fetch at 'https://us-central1-genial-lotto.cloudfunctions.net/addCustomClaims' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

I do not know what is wrong, maybe some project's configuration

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!