Reputation: 81
This where to store - access token and refresh token in OAuth 2.0 is the answer I was looking for but I have something that's not clear to me or maybe I'm just overthinking it.
Let's say I have a website X that calls a REST api and stores the refresh token in the browser as an HttpOnly cookie. If a malicious man M gets into some other guys computer that's already logged in X as U, M can go and look for the cookie and steal that refresh token. Then M will be able to retrieve all the tokens he wants for U, he will just need the client Id and client secret of that application, which he can get from any other user of the application, for example he himself M by just looking at the value of the header when a GET new access token call is made. Is that correct ?
Upvotes: 2
Views: 4302
Reputation: 8421
You should not use the Authentication Code grant in application running in browser. The Implicit grant is designed for such applications:
/token
endpoint which requires authentication (client ID and client secret) and you cannot keep the secret safe in a browser./token
endpoint usually doesn't support CORS headers - you cannot access it by JavaScript XHR calls.prompt=none
/auth
request parameter.Upvotes: 1