I have an Appengine/GWT application, and implemented OAuth. It works, but I do now a redirect in the Oauth callback. This redirect does not give a smooth user experience, since the application reloads after login.
This is my callback code:
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String oauth_provider = req.getParameter("oauth_provider");
String oauth_token = req.getParameter("oauth_token");
String oauth_verifier = req.getParameter("oauth_verifier");
String redirect = "http://www.exmaple.com";
OAuthProvider oAuthProvider = OAuthProvider.valueOf(oauth_provider);
String providerUserId = createUser(oAuthProvider, oauth_verifier, oauth_token); // which creates the user in my application if not yet existing
redirect = redirect.concat("?oauth_provider=" + oAuthProvider.name() + "&user=" + providerUserId);
resp.sendRedirect(redirect);
}
The client will then use he url parameters to get my the application user object.
Is there a better way to get back to the client, without a redirect?