private Response createCodeResponse(ContainerRequestContext rc, UriInfo ui) { MultivaluedMap<String, String> redirectState = createRedirectState(rc, ui); String theState = redirectState != null ? redirectState.getFirst(OAuthConstants.STATE) : null; String redirectScope = redirectState != null ? redirectState.getFirst(OAuthConstants.SCOPE) : null; String theScope = redirectScope != null ? redirectScope : scopes; UriBuilder ub = OAuthClientUtils.getAuthorizationURIBuilder( authorizationServiceUri, consumer.getClientId(), getAbsoluteRedirectUri(ui).toString(), theState, theScope); setFormPostResponseMode(ub, redirectState); setCodeVerifier(ub, redirectState); setAdditionalCodeRequestParams(ub, redirectState); URI uri = ub.build(); return Response.seeOther(uri).build(); }