<p dir="auto">According to <a href="https://firebase.google.com/docs/auth/admin/custom-claims#propagate_custom_claims_to_the_client" rel="nofollow">https://firebase.google.com/docs/auth/admin/custom-claims#propagate_custom_claims_to_the_client</a> one can update the claims locally by calling <code class="notranslate">currentUser.getIdToken(true)</code>.</p>
<p dir="auto">In flutter I guess one should be able to do the same with:</p>
<div class="highlight highlight-source-dart notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="final user = await FirebaseAuth.instance.currentUser();
await user.getIdToken(refresh: true);"><pre class="notranslate"><span class="pl-k">final</span> user <span class="pl-k">=</span> <span class="pl-k">await</span> <span class="pl-c1">FirebaseAuth</span>.instance.<span class="pl-en">currentUser</span>();
<span class="pl-k">await</span> user.<span class="pl-en">getIdToken</span>(refresh<span class="pl-k">:</span> <span class="pl-c1">true</span>);</pre></div>
<p dir="auto">Sadly this seems not reflected when I try to use firestore. After updating claims through a cloud function and then calling getIdToken as above it will still not have the claims correct in firestore rules. It returns "PERMISSION_DENIED". When I then close the app and reopen the app, firestore rules go through correctly though (seems like claims then get updated).</p>
<p dir="auto">Additional problem is, that I can not see if the claims locally got updated or not because the API for that is not yet implemented (see separate issue <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="347712029" data-permission-text="Title is private" data-url="https://github.com/flutter/flutter/issues/20238" data-hovercard-type="issue" data-hovercard-url="/flutter/flutter/issues/20238/hovercard" href="https://github.com/flutter/flutter/issues/20238">#20238</a>).</p>
<p dir="auto">Now the issue is: How can force propagation of the claims in flutter? The way the documentation says seems not to be correct. Is this a bug in the documentation or a bug in the flutter client?</p>
<p dir="auto">flutter: v0.8.2<br>
cloud_firestore: 0.8.1<br>
firebase_auth: 0.5.20</p>
<h3 dir="auto">Edit</h3>
<p dir="auto">After further investigations it seems to only be happening on Android. On iOS the claims seem to be updated nicely (seems to work even without calling getIdToken() ). So this problem seems Android specific.</p>
<p dir="auto">Hi community, I don't know if it's the right place to ask this. I use firebase for authenticating my users and I really need access to custom claims to have different behaviors in my applications based on some informations inside the custom claims.<br>
The doc <a href="https://firebase.google.com/docs/auth/admin/custom-claims" rel="nofollow">https://firebase.google.com/docs/auth/admin/custom-claims</a> provides example for android, I've looked into the firebase_auth doc and code and found nothing related.<br>
In my opinion it's a really important feature, maybe I've missed something somewhere, if it's the case I'm sorry.</p>