0
votes

i am trying to give custom claims to certain users for my react web app and i couldn't get past this error.

error:

TypeError: getCurves is not a function
./node_modules/jose/lib/registry/ec_curves.js
  2 | 
  3 | const curves = new Set()
  4 | 
> 5 | if (getCurves().includes('prime256v1')) {
  6 |   curves.add('P-256')
  7 | }
  8 | 

and this is the function the function which triggers it

    admin.auth().setCustomUserClaims(uid, {
      admin: true,
    })

this is how my admin sdk looks like

import * as admin from 'firebase-admin';

import serviceAccount from './Servicekey.json';

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: <databaseURL>
});

export default admin;

i used to update user profile (password, email) in similar fashion from my system but cannot do that either.

Are you sure it's coming from Firebase Admin ? - Dharmaraj
i never got such error with my web app before ... it is after using firebase-admin that i am facing this error. - Naveen Sharma
Web app? Where are you using firebase-admin? You must not use it on frontend. That has admin privileges, doesn't obey security rules and has full access to your Firebase project. You should use that in secure env like server or cloud functions only. It's not supposed to be used in frontend. - Dharmaraj
yeah ... i am just testing or basically giving just a single admin token to a user. i have no intentions of publishing it to all user base. - Naveen Sharma
I'd recommend using a node project and not react to do s or you can try Firebase Functions emulator locally. - Dharmaraj