title: Firebase custom claim how to set?
body: <p>I'm struggling with firebase custom claims.</p>
  
  <p>I have tested a lot of approaches nothing works. Obviously, I miss something important in the concept itself.</p>
  
  <p>So I'm back to the root. This script from the google example should apply customs rule on a newly created user</p>
  
  <pre class="lang-js prettyprint-override"><code>exports.processSignUp = functions.auth.user().onCreate(event =&gt; {
    const user = event.data; // The Firebase user.
    const customClaims = {
        param: true,
        accessLevel: 9
      };
    // Set custom user claims on this newly created user.
    return admin.auth().setCustomUserClaims(user.uid, customClaims)   
  
  });
  </code></pre>
  
  <p>Then on a client, I check the result with</p>
  
  <pre class="lang-js prettyprint-override"><code>firebase.auth().currentUser.getIdTokenResult()
                  .then((idTokenResult) =&gt; {
                      // Confirm the user is an Admin.
                      console.log(idTokenResult.claims)
                      if (!!idTokenResult.claims.param) {
                      // Show admin UI.
                      console.log("param")
                      } else {
                      // Show regular user UI.
                      console.log("no param")
                      }
                  })
                  .catch((error) =&gt; {
                      console.log(error);
                  });
  </code></pre>
  
  <p>Everything just a raw copy-paste still doesn't work. I've tested both from the local machine(there could be troubles with cors?) and deployed</p>