code: public int getExpiresIn(String tokenGrantType, String scope) {
          int expiresIn = Integer.MAX_VALUE;
          List<Scope> scopes = loadScopes(scope);
          boolean ccGrantType = TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType);
          if (TokenRequest.CLIENT_CREDENTIALS.equals(tokenGrantType)) {
              for (Scope s : scopes) {
                  if (s.getCcExpiresIn() < expiresIn) {
                      expiresIn = s.getCcExpiresIn();
                  }
              }
          } else if (TokenRequest.PASSWORD.equals(tokenGrantType)) {
              for (Scope s : scopes) {
                  if (s.getPassExpiresIn() < expiresIn) {
                      expiresIn = s.getPassExpiresIn();
                  }
              }
          } else {
              // refresh_token
              for (Scope s : scopes) {
                  if (s.getRefreshExpiresIn() < expiresIn) {
                      expiresIn = s.getRefreshExpiresIn();
                  }
              }
          }
          if (scopes.size() == 0 || expiresIn == Integer.MAX_VALUE) {
              expiresIn = (ccGrantType) ? OAuthConfig.DEFAULT_CC_EXPIRES_IN : OAuthConfig.DEFAULT_PASSWORD_EXPIRES_IN;
          }
          return expiresIn;
      }
docs: Returns value for expires_in by given scope and token type.
  
  @param scope          scope/s for which expires in will be returned
  @param tokenGrantType client_credentials or password type
  @return minimum value of given scope/s expires_in