Hello @Kholofelo , thank you for reaching out. It's not that the claim isn't returned, it's that it doesn't contain updated information from the Function App
To elaborate a little more in this case there are three entities involved: Function App (with information on the user and their password), B2C, and App. The user accessing the app after already validating credentials with the B2C and getting the token from B2C. Next, the application code sees the access token from B2C is going to expire.
In order to keep authentication, the application refreshes its token using a refresh token. But because we never go to the Function App which during the refresh time contains new information on the user, B2C won't get the updated information until they log in again. If that information was instead written to the B2C profile before refresh time, I am sure it would show in the new access token.
This is because we don't need to validate the user's identity with the Function App during refresh time because we've already done that during initial auth.
Now a fix that I can think off would work here, is adding the writing the claim value into the B2C user profile. You can use Microsoft Graph API and the user PATCH HTTP method to update the user profile. You can find more information here: https://learn.microsoft.com/en-us/azure/active-directory-b2c/user-flow-custom-attributes?pivots=b2c-custom-policy#using-custom-attribute-with-ms-graph-api
Hope this helps.
Do let us know if this helps and if there are any more queries around this, please do let us know so that we can help you further. Also, please do not forget to accept the response as an Answer; if the above response helped in answering your query.