Skip to content

Commit

Permalink
Use the old overload for base64
Browse files Browse the repository at this point in the history
  • Loading branch information
slisaasquatch committed Jan 30, 2024
1 parent c5a7ed1 commit a50ba4b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/saasquatch/sdk/internal/InternalUtils.java
Expand Up @@ -378,7 +378,8 @@ public static Map<String, Object> getJwtPayload(String jwt) {
throw new IllegalArgumentException("Invalid JWT");
}
final String payloadPart = jwtParts[1];
final byte[] payloadBytes = Base64.decodeBase64(payloadPart);
// Do not use the overload that takes a String. It does not work on Android.
final byte[] payloadBytes = Base64.decodeBase64(payloadPart.getBytes(UTF_8));
final JsonElement jsonElement = JsonParser.parseString(new String(payloadBytes, UTF_8));
if (!(jsonElement instanceof JsonObject)) {
throw new IllegalArgumentException("JWT payload is not a JSON object");
Expand Down

0 comments on commit a50ba4b

Please sign in to comment.