redpanda-data / redpanda-data/connect
Http_client oauth2 token refresh using refresh_token instead of client_credential
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 969
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 64
Description
Hi all! I need to implement, using http_client, oauth2 authentication with refresh_token flow (instead client_credential).
Specific use case are reported inside Google AdWords docs:
https://developers.google.com/google-ads/api/rest/auth
this is what I need to archive.
I'm in difficult to find the place where I can put
--data "grant_type=refresh_token" \
--data "refresh_token=REFRESH_TOKEN" \
using output http_client of benthos because it seams that not manage this kind of two params for token refresh.
this is the error that I receive:
{"@timestamp":"2022-04-14T09:07:20Z","@service":"benthos","component":"benthos.output","level":"ERROR","message":"Failed to send message to http_client: https://googleads.googleapis.com/v10/customers/123-123-123:uploadClickConversions: Post "https://googleads.googleapis.com/v10/customers/123-123-123:uploadClickConversions/": oauth2: cannot fetch token: 400 Bad Request\nResponse: {\n "error": "unsupported_grant_type",\n "error_description": "Invalid grant_type: client_credentials"\n}"}
output:
http_client:
url: https://googleads.googleapis.com/v10/customers/123-123-1231:uploadClickConversions
verb: POST
headers:
Content-Type: application/json
developer-token: "DEVTOKEN"
oauth2:
enabled: true
client_key: "CKEY"
client_secret: "CSECRET"
token_url: "https://www.googleapis.com/oauth2/v3/token"
I'm in difficult to put
--data "grant_type=refresh_token" \
--data "refresh_token=REFRESH_TOKEN" \
somewhere :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the http_client output's oauth2 configuration and token_url handling described in the issue, then trace how the current client-credentials request is built. Confirm the expected Google Ads refresh-token parameters and define done as successfully obtaining and using a token with refresh_token authentication.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, authentication
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100