This is because the Java Quickstart demo utilizes sessions to identify users. One of the reasons a session's lifetime ends is due to a user quitting the browser. Therefore when you close and then reopen a browser, the web app has no way to identify you since the session has ended.
The code that checks for a user's identity in sessions is in AuthFilter.java of the Quickstart demo project:
if (AuthUtil.getUserId(httpRequest) == null
|| AuthUtil.getCredential(AuthUtil.getUserId(httpRequest)) == null
|| AuthUtil.getCredential(AuthUtil.getUserId(httpRequest)).getAccessToken() == null) {
// redirect to auth flow
httpResponse.sendRedirect(WebUtil.buildUrl(httpRequest, "/oauth2callback"));
return;
}
If the servlet cannot find the user ID (as is the case when the user ID is no longer saved in a session), it runs the user through the authentication process again that starts with the httpResponse.sendRedirect call in the code above.