diff --git a/src/main/java/com/mercadopago/client/MercadoPagoClient.java b/src/main/java/com/mercadopago/client/MercadoPagoClient.java index 03470cb1..876c3bf5 100644 --- a/src/main/java/com/mercadopago/client/MercadoPagoClient.java +++ b/src/main/java/com/mercadopago/client/MercadoPagoClient.java @@ -285,7 +285,7 @@ private Map addDefaultHeaders(MPRequest request) { } if (!request.getUri().contains(OAUTH_TOKEN) && !headers.containsKey(Headers.AUTHORIZATION)) { - headers.put(Headers.AUTHORIZATION, String.format(BEARER, getAccessToken(null))); + headers.put(Headers.AUTHORIZATION, String.format(BEARER, request.getAccessToken())); } return headers; } @@ -298,10 +298,6 @@ private Map addCustomHeaders(String uri, MPRequestOptions reques } } - if (!uri.contains(OAUTH_TOKEN)) { - headers.put(Headers.AUTHORIZATION, String.format(BEARER, getAccessToken(requestOptions))); - } - return headers; }