I'm developing a micro frontend application where the container app handles user authentication and stores tokens in sessionStorage
. These tokens are needed to access various APIs with different scopes. What's the best way to manage tokens for different scopes and handle token expiration?
Specifically, I'm looking for guidance on:
Token Acquisition: Should I request tokens for different scopes individually, or is there a way to obtain tokens for multiple scopes in a single API call?
Token Renewal: How can I ensure that tokens are renewed when they expire, and is there a way to automate this process?
Centralized Storage: What's the best practice for storing tokens, and how can I retrieve them efficiently when making API requests in individual micro apps?
I'm using MSAL for authentication in a React-based micro frontend setup, and I'd appreciate any advice or best practices on handling tokens effectively in this scenario.