This project demonstrates best practices for high-security authentication in a React SPA using Auth0. It is designed for sensitive applications such as healthcare, where protecting user tokens is critical.
- Install React Auth0 SDK
- Create an AuthProvider component and set props for security:
cacheLocationto'memory'(tokens stored only in memory)useRefreshTokenstofalse(no refresh tokens in browser)
- Use the Auth0 method
getAccessTokenSilentlyto securely fetch access tokens for API calls, leveraging the user's session (no refresh tokens exposed to the browser) - Wrap your app's root with AuthProvider to enable authentication throughout your app