Add metaData / user data to AuthUser object
SaadBazaz opened this issue · 4 comments
Is your feature request related to a problem? Please describe.
I currently have to manage user state through either Redux, or useContext.
I was wondering, since AuthUser is already everywhere in the app, why not use it to store User Data as well?
Describe the solution you'd like and how you'd implement it
Perhaps a setter function to set AuthUser Metadata.
Is this a breaking change?
Not really. If implemented the right way, it should be totally backwards compatible.
Thanks for the suggestion. This feels a little out of scope to me. An app typically will manage more than just user-related state, and of course people shouldn't attach non-user app state to AuthUser. In my mind, the better pattern is the reverse: if you have a state management system, you could consider putting AuthUser data into it, if it's useful to have things in one place. Thoughts?
Thanks for the suggestion. This feels a little out of scope to me. An app typically will manage more than just user-related state, and of course people shouldn't attach non-user app state to AuthUser. In my mind, the better pattern is the reverse: if you have a state management system, you could consider putting AuthUser data into it, if it's useful to have things in one place. Thoughts?
Yes, that's how I'm currently doing it. It's just the problem of sync and revalidation. For example, if I do X action, I'd like to refresh AuthUser.
Trying to understand this better: What do you mean by "refreshing" AuthUser? Do you mean force-refreshing the ID token (for example, to update claims)? How are you currently accessing AuthUser data and refreshing it?
Closing this, as I believe this is out of scope for this library.