Skip to content

Commit

Permalink
fix(opencrvs-token-endpoint): update how access_token is fetched from…
Browse files Browse the repository at this point in the history
… opencrvs

Signed-off-by: Loganathan Sekar <[email protected]>
  • Loading branch information
naftis authored and Loganathan Sekar committed Feb 22, 2024
1 parent bea58af commit 294ff3b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public String getOIDCToken(String tokenEndpoint, String clientId, String clientS
private String getOpencrvsAuthTokenInterface(String tokenEndpoint, String clientId, String clientSecret) throws BaseCheckedException{
String body = "{" +
"\"client_id\":\"" + clientId + "\"" + "," +
"\"client_secret\":\"" + clientSecret + "\"" +
"\"client_secret\":\"" + clientSecret + "\"" + "," +
"\"grant_type\":\"client_credentials\"" +
"}";
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setContentType(MediaType.APPLICATION_JSON);
Expand All @@ -102,7 +103,7 @@ private String getOpencrvsAuthTokenInterface(String tokenEndpoint, String client
if (responseJson == null || responseJson.isEmpty()) {
throw ErrorCode.TOKEN_GENERATION_FAILED.throwChecked();
}
return new JSONObject(responseJson).getString("token");
return new JSONObject(responseJson).getString("access_token");
} catch (JSONException | RestClientException e) {
throw ErrorCode.TOKEN_GENERATION_FAILED.throwChecked(e);
}
Expand Down

0 comments on commit 294ff3b

Please sign in to comment.