Http input oauth2 google api

I’m trying to store value from google api into influx via telegraf.
I do have a bash script that take care of the token and authentication for now, but since telegraf support oauth now, I would like to get rid of my script.

Here’s my config

  urls = [
  client_id = ""
  client_secret = "XXXXXXX"
  token_url = ""

  name_override = "XXXX_Nest"
  method = "GET"
  data_format = "json"
  interval = "60s"

I’ve tried a lot of different thing and there is no way I can have it working properly.
The error I have is :
2023-07-17 18:37:00 2023-07-17T22:37:00Z E! [inputs.http] Error in plugin: [url=]: Get "": oauth2: "unsupported_grant_type" "Invalid grant_type: client_credentials"

Anybody have found a way to have google api working directly in telegraf?


It does not sound like the Google auth supports that grant type. This stackoverflow seems to confirm that as well. There may need to be custom support for whatever Google auth you are trying to use.

@xk3tchuPx did you setup a server-to-server aka “service account” for that API? I’m not exactly sure if there is a profile that does support the client credentials flow at all…