Last few days for some users, there are multiple (like thousands) oauth2 callback calls after first oauth auth request. There is no user activity, only first request into app which causes to redirect user to google account login/auth page with callback url and then only never-ending flood of GET oauth callback requests like this:
/application/page
/application/auth (scribe auth servlet, redirects user to accounts.google.com)
/application/authcallback
/application/authcallback
/application/authcallback
/application/authcallback
...
My workflow is as follows:
- filter detects if there is some logged user in session, if not, redirects to auth servlet
- auth servlet uses scribe oauth service to construct authorization url and redirects user to auth himself against google (accounts.google.com) and follow callback to
- auth callback servlet verifies access token and log user in
problem is that first 2 steps are only repeated once (that is ok), but after there is endless flood of valid callback requests originated somewhere else/by something else and every request happens to share same session
AuthServlet
ServiceBuilder builder = new ServiceBuilder();
OAuthService service = builder.provider(Google2Api.class)
.apiKey(CLIENT_ID)
.apiSecret(CLIENT_SECRET)
.callback(OAUTH_CALLBACK_URL)
.scope("https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile")
.build();
HttpSession sess = req.getSession();
sess.setAttribute(OAUTH_SERVICE_SESS_KEY, service);
String state = new BigInteger(130, new SecureRandom()).toString(32);
sess.setAttribute(OAUTH_STATE, state);
String authUrl = service.getAuthorizationUrl(null) + state;
resp.sendRedirect(authUrl);
CallbackServlet
OAuthService service = (OAuthService) sess.getAttribute(ScribeAuthServlet.OAUTH_SERVICE_SESS_KEY);
String code = req.getParameter("code");
Token token = service.getAccessToken(null, new Verifier(code));
// id_token & state check
String user = idToken.get("email");
sess.setAttribute("loggedUser", user);
resp.sendRedirect(APP_HOMEPAGE);
I am unable to find out what may cause the problem, as it involves only 1 of 1000 users, if it may be caused by some extension, browser config, network policy, ...?
Any ideas?