class_docstr: OneLogin StreamAlert App
class_docstr_tok: ["OneLogin","StreamAlert","App"]
docstr: Each request will request a new token to call the resources APIs.
  
  More details to be found here:
      https://developers.onelogin.com/api-docs/1/oauth20-tokens/generate-tokens-2
  
  Returns:
      str: Bearer token to be used to call the OneLogin resource APIs
docstr_tok: ["Each","request","will","request","a","new","token","to","call","the","resources","APIs",".","More","details","to","be","found","here",":","https",":","\/\/developers.onelogin.com\/api-docs\/1\/oauth20-tokens\/generate-tokens-2","Returns",":","str",":","Bearer","token","to","be","used","to","call","the","OneLogin","resource","APIs"]
code: def _generate_headers(self):
      """Each request will request a new token to call the resources APIs.
  
      More details to be found here:
          https://developers.onelogin.com/api-docs/1/oauth20-tokens/generate-tokens-2
  
      Returns:
          str: Bearer token to be used to call the OneLogin resource APIs
      """
      if self._auth_headers:
          return True
  
      authorization = "client_id: {}, client_secret: {}".format(
          self._config.auth["client_id"],
          self._config.auth["client_secret"],
      )
  
      headers_token = {
          "Authorization": authorization,
          "Content-Type": "application/json",
      }
  
      result, response = self._make_post_request(
          self._token_endpoint(),
          headers_token,
          {"grant_type": "client_credentials"},
      )
  
      if not result:
          return False
  
      if not response:
          LOGGER.error(
              "[%s] Response invalid, could not generate headers", self
          )
          return False
  
      bearer = "bearer:{}".format(response.get("access_token"))
      self._auth_headers = {"Authorization": bearer}
  
      return True
  
file_path: streamalert/streamalert/apps/_apps/onelogin.py
imports: import re
  from .None import AppIntegration, StreamAlertApp, get_logger
label_desc: Use image node_id 8 for calling the OneLoginApp obj's underlying member method code with example usage: obj._generate_headers() and returns: True, True, False, False