SampleOAuth2Provider.generateAccessAndRefreshToken(accessor);
String redirect_uri = request.getParameter(OAuth2.REDIRECT_URI);
String state = request.getParameter(OAuth2.STATE);
List<Parameter> list = new ArrayList<Parameter>(5);
list.add(new Parameter(OAuth2.ACCESS_TOKEN,accessor.accessToken));
list.add(new Parameter(OAuth2.TOKEN_TYPE,accessor.tokenType));
list.add(new Parameter(OAuth2.EXPIRES_IN,"3600"));
if(accessor.scope!=null) list.add(new Parameter(OAuth2.SCOPE,accessor.scope));
if(state != null){
list.add(new Parameter(OAuth2.STATE, state));
}
redirect_uri = OAuth2.addParametersAsFragment(redirect_uri,list);
response.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY);
response.setHeader("Location", OAuth2.decodePercent(redirect_uri));