I am building an application using JWT for authentication. I started doing some research and I am surprised by the lack of consensus about topics such as refresh tokens and storage for tokens.
As far as I can see JWT and OAuth are two different protocols and they follow different specifications.
OAuth uses a refresh token in order to get a new access token but in order to do so, there are 4 entities involved in the process, The User (The Front-end), The Resource Server (Facebook, Google, etc), The Client Server (e.g PHP Web Application) and the Authorisation Server.
In that case, it makes sense to have a refresh token because in order to refresh the token, it is required a client id and a client secret (issued by the Resource/Auth Server) which is known only by the Client Server and not by the User (User front end Side). So the refresh token would be useless for an attacker who stole the refresh token.
But my question is, for an application which is not authenticated against a third party Resource Server such as Google, Facebook and so on, Is it really useful to have a refresh token, why don't make the JWT token last as long as a refresh token.
On the other hand, I could see that when a refresh token is used along with a JWT token as This Article states, the refresh tokens are usually subject to strict storage requirements to ensure they are not leaked. However, I could not find What/Where and How I can store this token on the User side in order to meet those strick storage requirements.
Can someone please enlighten me about all of this? Thanks.
Note: I want to highlight that my web app is NOT using third party application to authenticate (Facebook, Google etc), it is Single Page App in the front-end side and in the server side a single API which issue a JWT token. My questions are focused on this kind of architecture