Reputation: 477
I entered my credentials and logged into a web application protected by OAuth Authorization Code flow. Then I performed below steps:
My understanding was as below:
Upvotes: 8
Views: 59550
Reputation: 9567
There are only so many places where you can persistently store data in the browser.
As of this writing:
If you are using libraries to implement the OAuth2 flow any of these could be used. You can find and inspect these storage systems under the "application" developer tools tab in Chrome, or similar spots in other browsers. What you can see/inspect depends on the domain you are currently on in the active tab.
If your client is server based, and thus confidential, you should store your token in a Secure HttpOnly cookie. Then proxy requests to the backend through your own server, including the bearer token from the cookie. This would be the best spot.
If your client is a single page application, you should consider storing it "in memory" and just reauthorize when reloading the page.
If that is not an option then Session Storage is your most secure option. This is most often used if OAuth2 is performed by your frontend.
In any case, if the OAuth2 flow is performed by frontend components only, it is to be expected that the token resides somewhere in the mentioned storage systems, and that it is included in the requests as visible in the network tab of your developer tools.
Upvotes: 8