private void executeTokenRequest(Request request, OidcCredentials credentials) throws IOException, ParseException {
        val tokenHttpRequest = request.toHTTPRequest();
        configuration.configureHttpRequest(tokenHttpRequest);

        val httpResponse = tokenHttpRequest.send();
        LOGGER.debug("Token response: status={}, content={}", httpResponse.getStatusCode(), httpResponse.getBody());

        val response = OIDCTokenResponseParser.parse(httpResponse);
        if (response instanceof TokenErrorResponse tokenErrorResponse) {
            val errorObject = tokenErrorResponse.getErrorObject();
            throw new OidcTokenException("Bad token response, error=" + errorObject.getCode() + "," +
                " description=" + errorObject.getDescription() + ", status=" + errorObject.getHTTPStatusCode());
        }
        LOGGER.debug("Token response successful");
        val tokenSuccessResponse = (OIDCTokenResponse) response;

        val oidcTokens = tokenSuccessResponse.getOIDCTokens();
        if (oidcTokens.getAccessToken() != null) {
            credentials.setAccessToken(oidcTokens.getAccessToken().toJSONObject());
        }
        if (oidcTokens.getRefreshToken() != null) {
            credentials.setRefreshToken(oidcTokens.getRefreshToken().toJSONObject());
        }
        if (oidcTokens.getIDToken() != null) {
            credentials.setIdToken(oidcTokens.getIDToken().serialize());
        }
    }
<p>createTokenRequest.</p>

@param grant a {@link AuthorizationGrant} object
@return a {@link TokenRequest} object
pac4j-oidc/src/main/java/org/pac4j/oidc/credentials/authenticator/OidcAuthenticator.java