public Token refreshToken ( Token token ) throws OAuthTokenException , JSONSerializerException , HttpClientException , URISyntaxException , InvalidRequestException { // Prepare the hash String doHash = clientSecret + "|" + token . getRefreshToken ( ) ; MessageDigest md ; try { md = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { throw new RuntimeException ( "Your JVM does not support SHA-256, which is required for OAuth with Smartsheet." , e ) ; } byte [ ] digest ; try { digest = md . digest ( doHash . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org . apache . commons . codec . binary . Hex . encodeHexString ( digest ) ; // Create a map of the parameters Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "grant_type" , "refresh_token" ) ; params . put ( "client_id" , clientId ) ; params . put ( "refresh_token" , token . getRefreshToken ( ) ) ; params . put ( "redirect_uri" , redirectURL ) ; params . put ( "hash" , hash ) ; // Generate the URL and get the token return requestToken ( QueryUtil . generateUrl ( tokenURL , params ) ) ; }
Refresh token .