When I signup via Facebook, the login flow is called and my token is enriched with the relevant data. However, after 2-4 days, the token suddenly no longer has the custom claims. The only thing that helps then is to delete the account so that the user has to register again.
I am unsure what might be causing the token to lose custom claims after 2-4 days. I recommend reviewing your tenant logs and the user’s profile to ensure that the data is still in user_metadata and that successful logins are reflected. Also, check the action tab in the successful login logs to verify if the action scripts executed properly.
Additionally, your post-login action script might need to use namespaced custom claims for them to be properly added. This could be the issue with the custom claims not persisting.