Advertisement
kikosiak

Untitled

Jun 3rd, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1.  
  2. public String getAccessToken() throws JsonProcessingException {
  3. String tokenUrl = "https://secure.snd.payu.com/pl/standard/user/oauth/authorize?grant_type=client_credentials&" + "client_id="
  4. + CLIENT_ID + "&client_secret="+CLIENT_SECRET;
  5.  
  6. RestTemplate client = new RestTemplate();
  7. ResponseEntity<String> response = client.getForEntity(tokenUrl,String.class);
  8. ObjectMapper mapper = new ObjectMapper();
  9. JsonNode root = mapper.readTree(response.getBody());
  10. return root.get("access_token").asText();
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement