-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Milestone
Description
Description
JWS cannot be deserialized in Android devices.
Steps to reproduce
- Add the required dependencies for an Android project as shown in the README.md
dependencies {
api('io.jsonwebtoken:jjwt-api:0.12.3')
runtimeOnly('io.jsonwebtoken:jjwt-impl:0.12.3')
runtimeOnly('io.jsonwebtoken:jjwt-orgjson:0.12.3') {
exclude(group: 'org.json', module: 'json') //provided by Android natively
}
}
- Create a parser
Jwts.parser()
.verifyWith(publicKey)
.build()
.parseSignedClaims(jwsString);
- Try to deserialize a signed JWT in an Android device
- An error is thrown:
java.lang.NoSuchMethodError: org.json.JSONTokener.<init>(Ljava/io/Reader;)V
Cause
Since 0.12.0, the class io.jsonwebtoken.orgjson.io.OrgJsonDeserializer
, in its parse()
method, is trying to create a JSONTokener
passing a Reader
as argument to the constructor.
This constructor is not available in the Android implementation of JSONTokener
: https://android.googlesource.com/platform/libcore/+/refs/heads/main/json/src/main/java/org/json/JSONTokener.java
Metadata
Metadata
Assignees
Labels
No labels