public String getAccessTokenFromRefreshToken(final AzureAdProfile azureAdProfile) {
        val azureConfig = (AzureAd2OidcConfiguration) getConfiguration();
        HttpURLConnection connection = null;
        try {
            final Map<String, String> headers = new HashMap<>();
            headers.put(HttpConstants.CONTENT_TYPE_HEADER, HttpConstants.APPLICATION_FORM_ENCODED_HEADER_VALUE);
            headers.put(HttpConstants.ACCEPT_HEADER, HttpConstants.APPLICATION_JSON);
            // get the token endpoint from discovery URI
            val tokenEndpointURL = azureConfig.getOpMetadataResolver().load().getTokenEndpointURI().toURL();
            connection = HttpUtils.openPostConnection(tokenEndpointURL, headers);

            val out = new BufferedWriter(new OutputStreamWriter(connection.getOutputStream(),
                StandardCharsets.UTF_8));
            out.write(azureConfig.makeOauth2TokenRequest(azureAdProfile.getRefreshToken().getValue()));
            out.close();

            val responseCode = connection.getResponseCode();
            if (responseCode != 200) {
                throw new OidcTokenException("request for access token failed: " + HttpUtils.buildHttpErrorMessage(connection));
            }
            var body = HttpUtils.readBody(connection);
            final Map<String, Object> res = objectMapper.readValue(body, typeRef);
            return (String) res.get("access_token");
        } catch (final IOException e) {
            throw new OidcException(e);
        } finally {
            HttpUtils.closeConnection(connection);
        }
    }
<p>Refresh the access token</p>
<p>https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow#refresh-the-access-token</p>

@param azureAdProfile a {@link AzureAdProfile} object
@return a {@link String} object
pac4j-oidc/src/main/java/org/pac4j/oidc/client/AzureAd2Client.java