Skip to content

Commit

Permalink
adjusting set of access token
Browse files Browse the repository at this point in the history
  • Loading branch information
mariannebiancamb committed Apr 25, 2024
1 parent 336e4c7 commit 2a38af1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/mercadopago/client/MercadoPagoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private Map<String, String> addDefaultHeaders(MPRequest request) {
headers.put(Headers.IDEMPOTENCY_KEY, request.createIdempotencyKey());
}

if (!request.getUri().contains(OAUTH_TOKEN) && !headers.containsKey(Headers.AUTHORIZATION)) {
if (request!= null && !request.getUri().contains(OAUTH_TOKEN) && request.getAccessToken() != null) {
headers.put(Headers.AUTHORIZATION, String.format(BEARER, request.getAccessToken()));
}
return headers;
Expand All @@ -298,6 +298,10 @@ private Map<String, String> addCustomHeaders(String uri, MPRequestOptions reques
}
}

if (requestOptions!= null && !uri.contains(OAUTH_TOKEN)) {
headers.put(Headers.AUTHORIZATION, String.format(BEARER, getAccessToken(requestOptions)));
}

return headers;
}

Expand Down

0 comments on commit 2a38af1

Please sign in to comment.