Skip to content

Commit

Permalink
Merge pull request #285 from mercadopago/fix/adjusting-set-access-token
Browse files Browse the repository at this point in the history
[FIX] Adjusting set of access token
  • Loading branch information
mariannebiancamb authored Apr 26, 2024
2 parents 9e5d252 + bbfd8fa commit 4facb9f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ already.
<dependency>
<groupId>com.mercadopago</groupId>
<artifactId>sdk-java</artifactId>
<version>2.1.22</version>
<version>2.1.23</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.mercadopago</groupId>
<artifactId>sdk-java</artifactId>
<version>2.1.22</version>
<version>2.1.23</version>
<packaging>jar</packaging>

<name>Mercadopago SDK</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/mercadopago/MercadoPagoConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/** Mercado Pago configuration class. */
public class MercadoPagoConfig {

public static final String CURRENT_VERSION = "2.1.22";
public static final String CURRENT_VERSION = "2.1.23";

public static final String PRODUCT_ID = "BC32A7VTRPP001U8NHJ0";

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/mercadopago/client/MercadoPagoClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ private Map<String, String> addDefaultHeaders(MPRequest request) {
headers.put(Headers.IDEMPOTENCY_KEY, request.createIdempotencyKey());
}

if (!request.getUri().contains(OAUTH_TOKEN) && !headers.containsKey(Headers.AUTHORIZATION)) {
headers.put(Headers.AUTHORIZATION, String.format(BEARER, getAccessToken(null)));
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,7 +298,7 @@ private Map<String, String> addCustomHeaders(String uri, MPRequestOptions reques
}
}

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

Expand Down

0 comments on commit 4facb9f

Please sign in to comment.