I'm new to React and want to securely store the OAuth2 access token to invoke APIs. I have found following options,
- Keep it in the local-store/session-store (This can be vulnerable to XSS attacks)
- Having a back-end for the React application and store access token in back-end session and keep a session cookie to identify browser session. Then make all the API calls through back-end to add Bearer header.
- Encrypt the access token and store it as a cookie. API access will be haven through the back-end where encrypted cookie will be decrypted and added as a Bearer header.
What will be the best solution for this?