Skip to content

Commit 7c8bc2a

Browse files
authored
Update AppTokenJavaExample.java
1 parent b31b46a commit 7c8bc2a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Java/src/main/java/AppTokenJavaExample.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,14 @@ public static String getApplicantStatus(String applicantId) throws NoSuchAlgorit
9797
}
9898

9999
public static String getAccessToken(String externalUserId, String levelName) throws NoSuchAlgorithmException, InvalidKeyException, IOException {
100-
// https://docs.sumsub.com/reference/generate-access-token-query
100+
// https://docs.sumsub.com/reference/generate-access-token
101101

102-
Response response = sendPost("/resources/accessTokens?userId=" + URLEncoder.encode(externalUserId, StandardCharsets.UTF_8.toString()) + "&levelName=" + URLEncoder.encode(levelName, StandardCharsets.UTF_8.toString()), RequestBody.create(new byte[0], null));
102+
AccessToken accessTokenRequest = new AccessToken(externalUserId, levelName);
103+
104+
Response response = sendPost("/resources/accessTokens/sdk",
105+
RequestBody.create(
106+
objectMapper.writeValueAsString(accessTokenRequest),
107+
MediaType.parse("application/json; charset=utf-8")));
103108

104109
ResponseBody responseBody = response.body();
105110
return responseBody != null ? responseBody.string() : null;

0 commit comments

Comments
 (0)