List<String> approvedScope,
UserSubject userSubject,
ServerAccessToken preauthorizedToken) {
// in this flow the code is still created, the preauthorized token
// will be retrieved by the authorization code grant handler
AuthorizationCodeRegistration codeReg = new AuthorizationCodeRegistration();
codeReg.setClient(client);
codeReg.setRedirectUri(redirectUri);
codeReg.setRequestedScope(requestedScope);
codeReg.setApprovedScope(approvedScope);
codeReg.setSubject(userSubject);
codeReg.setAudience(params.getFirst(OAuthConstants.CLIENT_AUDIENCE));
codeReg.setClientCodeVerifier(params.getFirst(OAuthConstants.AUTHORIZATION_CODE_VERIFIER));
ServerAuthorizationCodeGrant grant = null;
try {
grant = ((AuthorizationCodeDataProvider)getDataProvider()).createCodeGrant(codeReg);
} catch (OAuthServiceException ex) {