code: public void addAuthToken(ClientRequest request, String token) {
          if(token != null && !token.startsWith("Bearer ")) {
              if(token.toUpperCase().startsWith("BEARER ")) {
                  // other cases of Bearer
                  token = "Bearer " + token.substring(7);
              } else {
                  token = "Bearer " + token;
              }
          }
          request.getRequestHeaders().put(Headers.AUTHORIZATION, token);
      }
docs: Add Authorization Code grant token the caller app gets from OAuth2 server.
  
  This is the method called from client like web server
  
  @param request the http request
  @param token the bearer token