oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/endpoint/OAuth2AuthorizationCodeGrantRequestEntityConverter.java
private MultiValueMap<String, String> buildFormParameters(OAuth2AuthorizationCodeGrantRequest authorizationCodeGrantRequest) {
		ClientRegistration clientRegistration = authorizationCodeGrantRequest.getClientRegistration();
		OAuth2AuthorizationExchange authorizationExchange = authorizationCodeGrantRequest.getAuthorizationExchange();

		MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>();
		formParameters.add(OAuth2ParameterNames.GRANT_TYPE, authorizationCodeGrantRequest.getGrantType().getValue());
		formParameters.add(OAuth2ParameterNames.CODE, authorizationExchange.getAuthorizationResponse().getCode());
		String redirectUri = authorizationExchange.getAuthorizationRequest().getRedirectUri();
		String codeVerifier = authorizationExchange.getAuthorizationRequest().getAttribute(PkceParameterNames.CODE_VERIFIER);
		if (redirectUri != null) {
			formParameters.add(OAuth2ParameterNames.REDIRECT_URI, redirectUri);
		}
		if (!ClientAuthenticationMethod.BASIC.equals(clientRegistration.getClientAuthenticationMethod())) {
			formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId());
		}
		if (ClientAuthenticationMethod.POST.equals(clientRegistration.getClientAuthenticationMethod())) {
			formParameters.add(OAuth2ParameterNames.CLIENT_SECRET, clientRegistration.getClientSecret());
		}
		if (codeVerifier != null) {
			formParameters.add(PkceParameterNames.CODE_VERIFIER, codeVerifier);
		}

		return formParameters;
	}
private MultiValueMap<String, String> buildFormParameters(OAuth2AuthorizationCodeGrantRequest authorizationCodeGrantRequest) {
		ClientRegistration clientRegistration = authorizationCodeGrantRequest.getClientRegistration();
		OAuth2AuthorizationExchange authorizationExchange = authorizationCodeGrantRequest.getAuthorizationExchange();

		MultiValueMap<String, String> formParameters = new LinkedMultiValueMap<>();
		formParameters.add(OAuth2ParameterNames.GRANT_TYPE, authorizationCodeGrantRequest.getGrantType().getValue());
		formParameters.add(OAuth2ParameterNames.CODE, authorizationExchange.getAuthorizationResponse().getCode());
		String redirectUri = authorizationExchange.getAuthorizationRequest().getRedirectUri();
		String codeVerifier = authorizationExchange.getAuthorizationRequest().getAttribute(PkceParameterNames.CODE_VERIFIER);
		if (redirectUri != null) {
			formParameters.add(OAuth2ParameterNames.REDIRECT_URI, redirectUri);
		}
		if (!ClientAuthenticationMethod.BASIC.equals(clientRegistration.getClientAuthenticationMethod())) {
			formParameters.add(OAuth2ParameterNames.CLIENT_ID, clientRegistration.getClientId());
		}
		if (ClientAuthenticationMethod.POST.equals(clientRegistration.getClientAuthenticationMethod())) {
			formParameters.add(OAuth2ParameterNames.CLIENT_SECRET, clientRegistration.getClientSecret());
		}
		if (codeVerifier != null) {
			formParameters.add(PkceParameterNames.CODE_VERIFIER, codeVerifier);
		}

		return formParameters;
	}
private MultiValueMap < String , String > buildFormParameters ( OAuth2AuthorizationCodeGrantRequest authorizationCodeGrantRequest ) { ClientRegistration clientRegistration = authorizationCodeGrantRequest . getClientRegistration ( ) ; OAuth2AuthorizationExchange authorizationExchange = authorizationCodeGrantRequest . getAuthorizationExchange ( ) ; MultiValueMap < String , String > formParameters = new LinkedMultiValueMap <> ( ) ; formParameters . add ( OAuth2ParameterNames . GRANT_TYPE , authorizationCodeGrantRequest . getGrantType ( ) . getValue ( ) ) ; formParameters . add ( OAuth2ParameterNames . CODE , authorizationExchange . getAuthorizationResponse ( ) . getCode ( ) ) ; String redirectUri = authorizationExchange . getAuthorizationRequest ( ) . getRedirectUri ( ) ; String codeVerifier = authorizationExchange . getAuthorizationRequest ( ) . getAttribute ( PkceParameterNames . CODE_VERIFIER ) ; if ( redirectUri != null ) { formParameters . add ( OAuth2ParameterNames . REDIRECT_URI , redirectUri ) ; } if ( ! ClientAuthenticationMethod . BASIC . equals ( clientRegistration . getClientAuthenticationMethod ( ) ) ) { formParameters . add ( OAuth2ParameterNames . CLIENT_ID , clientRegistration . getClientId ( ) ) ; } if ( ClientAuthenticationMethod . POST . equals ( clientRegistration . getClientAuthenticationMethod ( ) ) ) { formParameters . add ( OAuth2ParameterNames . CLIENT_SECRET , clientRegistration . getClientSecret ( ) ) ; } if ( codeVerifier != null ) { formParameters . add ( PkceParameterNames . CODE_VERIFIER , codeVerifier ) ; } return formParameters ; }
Returns a {@link MultiValueMap} of the form parameters used for the Access Token Request body.

@param authorizationCodeGrantRequest the authorization code grant request
@return a {@link MultiValueMap} of the form parameters used for the Access Token Request body
Returns a { @link MultiValueMap } of the form parameters used for the Access Token Request body .